Anonymous user
Sequence: smallest number with exactly n divisors: Difference between revisions
Sequence: smallest number with exactly n divisors (view source)
Revision as of 23:07, 11 April 2019
, 5 years ago→{{header|zkl}}: tweak
(→{{header|zkl}}: added code) |
m (→{{header|zkl}}: tweak) |
||
Line 325:
<lang zkl>fcn countDivisors(n)
{ [1.. n.toFloat().sqrt()].reduce('wrap(s,i){ s + (if(0==n%i) 1 + (i!=n/i)) },0) }
▲ var N=0,cache=Dictionary();
▲ if(cache.find(n)) return(cache.pop(n)); // prune
if(n == (d:=countDivisors(N+=1))) return(N);
▲ while(1){
});</lang>▼
▲ })
▲}</lang>
<lang zkl>N:=15;
println("First %d terms of OEIS:A005179
A005179w
{{out}}
<pre>
First 15 terms of OEIS:A005179
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144
</pre>
|