DEV Community


Discussion on: Project Euler #5 - Finding the Smallest Multiple

thorstenhirsch profile image
Thorsten Hirsch • Edited

Perl 6 has an lcm operator (no modules/libraries necessary):

say [lcm] 1..20;

I guess you won't find a solution shorter than this one. However I doubt that this makes Perl 6 attractive. The more features the language has, the more you have to learn. If you master it, it sure is fun to write code like this or the next example:

say [+] grep * %% (3|5), ^1000;

It's a solution for Euler#1 and it's another example that the language has a ton of features that enable you to write super short code. Unfortunately it also gets harder to read, some might even call it gibberish.

But you can also write beautiful code in Perl 6. Here are solutions for Project Euler Problems, super-short ones as well as beautiful ones. 😄