Sequence: smallest number with exactly n divisors: Difference between revisions

julia example
m (Convert to a task.)
(julia example)
Line 309:
[1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60, 4096, 192, 144]
</pre>
 
=={{header|Julia}}==
{{trans|Perl}}
<lang julia>using Primes
 
function numfactors(n)
f = [one(n)]
for (p,e) in factor(n)
f = reduce(vcat, [f*p^j for j in 1:e], init=f)
end
length(f)
end
 
function A005179(N)
println("First $N terms of OEIS sequence A005179: ")
for i in 1:N
j = 0
while (j += 1) > 0
if i == numfactors(j)
print("$j ")
break
end
end
end
end
 
A005179(15)
</lang>{{out}}
<pre>
First 15 terms of OEIS sequence A005179:
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144
</pre>
 
 
=={{header|Kotlin}}==
4,108

edits