Permalink
Browse files

Increase timing-table-generator's workload, add gerdr++'s version.

  • Loading branch information...
1 parent 84c1bf9 commit 71843830facc4f40e47b7baac6bfed90229c9df4 @colomon committed Dec 21, 2012
Showing with 13 additions and 1 deletion.
  1. +12 −0 bin/collatz-gerdr.pl
  2. +1 −1 bin/timing-table-generator.pl
View
@@ -0,0 +1,12 @@
+sub collatz-length(Int $n) {
+ state %cache = 1 => 1;
+ %cache{$n} //= 1 + collatz-length($n %% 2 ?? $n div 2 !! 3 * $n + 1);
+}
+
+sub MAIN(*@numbers) {
+ for @numbers -> $n {
+ say "$n: " ~ collatz-length($n.Int);
+ }
+}
+
+
@@ -1,4 +1,4 @@
-my @numbers = 1..200, 10000..10200;
+my @numbers = 1..300, 10000..10300;
my $rakudo = "perl6";
my $niecza = "mono ../niecza/run/Niecza.exe";

0 comments on commit 7184383

Please sign in to comment.