Sequence: smallest number greater than previous term with exactly n divisors: Difference between revisions
Content added Content deleted
imported>Maxima enthusiast No edit summary |
imported>Chinhouse No edit summary |
||
Line 947: | Line 947: | ||
[1,2,4,6,16,18,64,66,100,112,1024,1035,4096,4288,4624] |
[1,2,4,6,16,18,64,66,100,112,1024,1035,4096,4288,4624] |
||
</pre> |
</pre> |
||
=={{header|MiniScript}}== |
|||
This GUI implementation is for use with [http://miniscript.org/MiniMicro Mini Micro]. |
|||
<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 = [] |
|||
j = 1 |
|||
for i in range(1, 15) |
|||
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, 18, 64, 66, 100, 112, 1024, 1035, 4096, 4288, 4624</pre> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |