Home primes: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: tweak output) |
Thundergnat (talk | contribs) m (→{{header|Raku}}: Add links, minor style twiddles) |
||
Line 84: | Line 84: | ||
=={{header|Raku}}== |
=={{header|Raku}}== |
||
Using [https://modules.raku.org/search/?q=Prime+Factor Prime::Factor] from the [https://modules.raku.org/ Raku ecosystem]. |
|||
<lang perl6>use Prime::Factor; |
<lang perl6>use Prime::Factor; |
||
for flat 2..20, 65 -> $m { |
for flat 2..20, 65 -> $m { |
||
my ($n, @steps, @factors) = $m; |
my ($n, $step, @steps, @factors) = $m, 0; |
||
@steps.push: $n = @factors.join.Int while (@factors = prime-factors |
@steps.push: $n = @factors.join.Int while (@factors = prime-factors $n) > 1; |
||
⚫ | |||
my $s = 0; |
|||
⚫ | |||
+@steps ?? " = {@steps.tail}" !! $m; |
+@steps ?? " = {@steps.tail}" !! $m; |
||
}</lang> |
}</lang> |