Sequence: smallest number with exactly n divisors: Difference between revisions
Sequence: smallest number with exactly n divisors (view source)
Revision as of 18:10, 5 April 2022
, 2 years agoAdded XPL0 example.
ReeceGoding (talk | contribs) m (→{{header|R}}: Syntax highlighting.) |
(Added XPL0 example.) |
||
Line 2,193:
The first 22 terms are:
[1, 2, 4, 6, 16, 12, 64, 24, 36, 48, 1024, 60, 4096, 192, 144, 120, 65536, 180, 262144, 240, 576, 3072]
</pre>
=={{header|XPL0}}==
<lang XPL0>func Divisors(N); \Return number of divisors of N
int N, Count, D;
[Count:= 0;
for D:= 1 to N do
if rem(N/D) = 0 then Count:= Count+1;
return Count;
];
int N, AN;
[for N:= 1 to 15 do
[AN:= 0;
repeat AN:= AN+1 until Divisors(AN) = N;
IntOut(0, AN); ChOut(0, ^ );
];
]</lang>
{{out}}
<pre>
1 2 4 6 16 12 64 24 36 48 1024 60 4096 192 144
</pre>
|