Anonymous user
Sequence: smallest number with exactly n divisors: Difference between revisions
Sequence: smallest number with exactly n divisors (view source)
Revision as of 21:30, 7 January 2020
, 4 years agono edit summary
No edit summary |
|||
Line 402:
</pre>
=={{header|Maple}}==
<lang Maple>
with(NumberTheory):
with(ArrayTools):
countDivisors := proc(x::integer)
return numelems(Divisors(x));
end proc:
sequenceValue := proc(x::integer)
local count:
for count from 1 to infinity while not countDivisors(count) = x do end:
return count;
end proc:
A := Array([]):
for number from 1 to 15 do
A := Append(A,sequenceValue(number)):
end:
print(A);
</lang>
{{out}}<pre>
[1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60, 4096, 192, 144]
</pre>
=={{header|Nim}}==
{{trans|Kotlin}}
|