Numbers which are the cube roots of the product of their proper divisors: Difference between revisions

Added XPL0 example.
(Added Quackery.)
(Added XPL0 example.)
Line 1,005:
<pre>
Same as first version.
</pre>
 
=={{header|XPL0}}==
{{trans|C++}}
<syntaxhighlight lang "XPL0">func DivisorCount(N); \Return count of divisors
int N, Total, P, Count;
[Total:= 1;
while (N&1) = 0 do
[Total:= Total+1;
N:= N>>1;
];
P:= 3;
while P*P <= N do
[Count:= 1;
while rem(N/P) = 0 do
[Count:= Count+1;
N:= N/P;
];
Total:= Total*Count;
P:= P+2;
];
if N > 1 then
Total:= Total*2;
return Total;
];
 
int N, Count;
[Text(0, "First 50 numbers which are the cube roots of the products of ");
Text(0, "their proper divisors:^m^j");
N:= 1; Count:= 0;
repeat if N = 1 or DivisorCount(N) = 8 then
[Count:= Count+1;
if Count <= 50 then
[Format(4, 0);
RlOut(0, float(N));
if rem(Count/10) = 0 then CrLf(0);
]
else if Count = 500 or Count = 5000 or Count = 50000 then
[Format(6, 0);
RlOut(0, float(Count));
Text(0, "th: ");
IntOut(0, N);
CrLf(0);
];
];
N:= N+1;
until Count >= 50000;
]</syntaxhighlight>
{{out}}
<pre>
First 50 numbers which are the cube roots of the products of their proper divisors:
1 24 30 40 42 54 56 66 70 78
88 102 104 105 110 114 128 130 135 136
138 152 154 165 170 174 182 184 186 189
190 195 222 230 231 232 238 246 248 250
255 258 266 273 282 285 286 290 296 297
500th: 2526
5000th: 23118
50000th: 223735
</pre>
297

edits