Anonymous user
Sequence: smallest number with exactly n divisors: Difference between revisions
Sequence: smallest number with exactly n divisors (view source)
Revision as of 03:26, 13 November 2023
, 7 months agono edit summary
(Easylang) |
imported>Chinhouse No edit summary |
||
Line 1,126:
14 192
15 144</pre>
=={{header|MiniScript}}==
<syntaxhighlight lang="miniscript">
divisors = function(n)
divs = {1: 1}
divs[n] = 1
i = 2
while i * i <= n
if n % i == 0 then
divs[i] = 1
divs[n / i] = 1
end if
i += 1
end while
return divs.indexes
end function
counts = []
for i in range(1, 15)
j = 1
while divisors(j).len != i
j += 1
end while
counts.push(j)
end for
print "The first 15 terms in the sequence are:"
print counts.join(", ")
</syntaxhighlight>
{{out}}
<pre>
The first 15 terms in the sequence are:
1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60, 4096, 192, 144</pre>
=={{header|Miranda}}==
|