|
|
Line 2,791: |
Line 2,791: |
|
2000..2005th: 21475 21481 21487 21493 21503 21511 |
|
2000..2005th: 21475 21481 21487 21493 21503 21511 |
|
triplets < 250: (1 3 7) (5 7 11) (11 13 17) (23 25 29) (41 43 47) (173 175 179) (221 223 227) (233 235 239)</pre> |
|
triplets < 250: (1 3 7) (5 7 11) (11 13 17) (23 25 29) (41 43 47) (173 175 179) (221 223 227) (233 235 239)</pre> |
|
|
|
⚫ |
|
|
⚫ |
{{works with|rakudo|2015-09-18}} |
|
⚫ |
This implementation has no arbitrary upper limit, since it can keep adding new rotors on the fly. It just gets slower and slower instead... <tt>:-)</tt> |
|
⚫ |
<lang perl6>constant @ludic = gather { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
loop (my $j = 0; $j < @rotor; $j++) { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
@rotor[$j] = @taken[$j+1]; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
push @rotor, @taken[$j+1]; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
say "Number of Ludic numbers <= 1000: ", +(@ludic ...^ * > 1000); |
|
⚫ |
say "Ludic numbers 2000..2005: ", @ludic[1999..2004]; |
|
⚫ |
|
|
⚫ |
my \l250 = set @ludic ...^ * > 250; |
|
⚫ |
say "Ludic triples < 250: ", gather |
|
⚫ |
for l250.keys.sort -> $a { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
take "<$a $b $c>" if $b ∈ l250 and $c ∈ l250; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
<pre>(1 2 3 5 7 11 13 17 23 25 29 37 41 43 47 53 61 67 71 77 83 89 91 97 107) |
|
⚫ |
Number of Ludic numbers <= 1000: 142 |
|
⚫ |
Ludic numbers 2000..2005: (21475 21481 21487 21493 21503 21511) |
|
⚫ |
Ludic triples < 250: (<1 3 7> <5 7 11> <11 13 17> <23 25 29> <41 43 47> <173 175 179> <221 223 227> <233 235 239>)</pre> |
|
|
|
|
|
|
=={{header|Phix}}== |
|
=={{header|Phix}}== |
Line 3,260: |
Line 3,222: |
|
((1 3 7) (5 7 11) (11 13 17) (23 25 29) (41 43 47) (173 175 179) (221 223 227) (233 235 239)) |
|
((1 3 7) (5 7 11) (11 13 17) (23 25 29) (41 43 47) (173 175 179) (221 223 227) (233 235 239)) |
|
cpu time: 18753 real time: 18766 gc time: 80</pre> |
|
cpu time: 18753 real time: 18766 gc time: 80</pre> |
|
|
|
|
⚫ |
|
|
|
(formerly Perl 6) |
|
⚫ |
{{works with|rakudo|2015-09-18}} |
|
⚫ |
This implementation has no arbitrary upper limit, since it can keep adding new rotors on the fly. It just gets slower and slower instead... <tt>:-)</tt> |
|
⚫ |
<lang perl6>constant @ludic = gather { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
loop (my $j = 0; $j < @rotor; $j++) { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
@rotor[$j] = @taken[$j+1]; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
push @rotor, @taken[$j+1]; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
|
|
⚫ |
say "Number of Ludic numbers <= 1000: ", +(@ludic ...^ * > 1000); |
|
⚫ |
say "Ludic numbers 2000..2005: ", @ludic[1999..2004]; |
|
⚫ |
|
|
⚫ |
my \l250 = set @ludic ...^ * > 250; |
|
⚫ |
say "Ludic triples < 250: ", gather |
|
⚫ |
for l250.keys.sort -> $a { |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
take "<$a $b $c>" if $b ∈ l250 and $c ∈ l250; |
|
⚫ |
|
|
⚫ |
|
|
⚫ |
<pre>(1 2 3 5 7 11 13 17 23 25 29 37 41 43 47 53 61 67 71 77 83 89 91 97 107) |
|
⚫ |
Number of Ludic numbers <= 1000: 142 |
|
⚫ |
Ludic numbers 2000..2005: (21475 21481 21487 21493 21503 21511) |
|
⚫ |
Ludic triples < 250: (<1 3 7> <5 7 11> <11 13 17> <23 25 29> <41 43 47> <173 175 179> <221 223 227> <233 235 239>)</pre> |
|
|
|
|
|
=={{header|REXX}}== |
|
=={{header|REXX}}== |