Numbers which are the cube roots of the product of their proper divisors: Difference between revisions
Numbers which are the cube roots of the product of their proper divisors (view source)
Revision as of 07:18, 9 January 2023
, 1 year agoAdded 11l
m (→{{header|jq}}) |
Alextretyak (talk | contribs) (Added 11l) |
||
Line 19:
<br>
=={{header|11l}}==
<syntaxhighlight lang="11l">
F product_of_proper_divisors(n)
V prod = Int64(1)
L(d) 2 .< Int(sqrt(n) + 1)
I n % d == 0
prod *= d
V otherD = n I/ d
I otherD != d
prod *= otherD
R prod
print(‘First 50 numbers which are the cube roots of the products of their proper divisors:’)
V found = 0
L(num) 1..
I Int64(num) ^ 3 == product_of_proper_divisors(num)
found++
I found <= 50
print(f:‘{num:3}’, end' I found % 10 == 0 {"\n"} E ‘ ’)
E I found C (500, 5000, 50000)
print(f:‘{commatize(found):6}th: {commatize(num)}’)
I found == 50000
L.break
</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: 2,526
5,000th: 23,118
50,000th: 223,735
</pre>
=={{header|ALGOL 68}}==
|