Sequence: smallest number with exactly n divisors: Difference between revisions
Content deleted Content added
Thundergnat (talk | contribs) Rename Perl 6 -> Raku, alphabetize, minor clean-up |
|||
Line 57:
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144
</pre>
=={{header|AWK}}==
<lang AWK>
Line 177 ⟶ 178:
1 2 4 6 16 12 64 24 36 48 1024 60 0 192 144
</pre>
=={{header|F_Sharp|F#}}==
This task uses [http://www.rosettacode.org/wiki/Extensible_prime_generator#The_function Extensible Prime Generator (F#)]
Line 507 ⟶ 509:
{{out}}
<pre>First 15 terms of OEIS: A005179
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144</pre>▼
=={{header|Perl 6}}==▼
{{works with|Rakudo|2019.03}}▼
<lang perl6>sub div-count (\x) {▼
return 2 if x.is-prime;▼
+flat (1 .. x.sqrt.floor).map: -> \d {▼
unless x % d { my \y = x div d; y == d ?? y !! (y, d) }▼
}▼
}▼
my $limit = 15;▼
put "First $limit terms of OEIS:A005179";▼
put (1..$limit).map: -> $n { first { $n == .&div-count }, 1..Inf };▼
</lang>▼
{{out}}▼
<pre>First 15 terms of OEIS:A005179▼
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144</pre>
Line 876 ⟶ 858:
144
</lang>
(formerly Perl 6)
▲{{works with|Rakudo|2019.03}}
▲<lang perl6>sub div-count (\x) {
▲ return 2 if x.is-prime;
▲ +flat (1 .. x.sqrt.floor).map: -> \d {
▲ unless x % d { my \y = x div d; y == d ?? y !! (y, d) }
▲ }
▲}
▲my $limit = 15;
▲put "First $limit terms of OEIS:A005179";
▲put (1..$limit).map: -> $n { first { $n == .&div-count }, 1..Inf };
▲</lang>
▲{{out}}
▲<pre>First 15 terms of OEIS:A005179
▲1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144</pre>
=={{header|REXX}}==
|