Created
January 21, 2017 23:49
-
-
Save dogbert17/b052a9da0457916c5f8300990cdad35f to your computer and use it in GitHub Desktop.
code slowdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $sum = 0; | |
for (1..2015) -> $term { | |
$sum += $term; | |
my $factors = (1..floor(sqrt($sum))).grep(-> $x { $sum % $x == 0} ).elems * 2; | |
$factors-- if floor(sqrt($sum)) == sqrt($sum); | |
} | |
say now - INIT now; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment