Erdős-Nicolas numbers: Difference between revisions
Content added Content deleted
m (Added language identifier.) |
(Initial FutureBasic task solution added) |
||
Line 454: | Line 454: | ||
91963648 equals the sum of its first 142 divisors |
91963648 equals the sum of its first 142 divisors |
||
</pre> |
</pre> |
||
=={{header|FutureBasic}}== |
|||
<syntaxhighlight lang="futurebasic"> |
|||
_limit = 500000 |
|||
void local fn ErdosNicolasNumbers |
|||
long i, j, sum( _limit ), count( _limit ) |
|||
for i = 0 to _limit |
|||
sum(i) = 1 |
|||
count(i) = 1 |
|||
next |
|||
for i = 2 to _limit |
|||
j = i + i |
|||
while ( j <= _limit ) |
|||
if sum(j) == j then printf @"%8ld == sum of its first %3ld divisors", j, count(j) |
|||
sum(j) = sum(j) + i |
|||
count(j) = count(j) + 1 |
|||
j = j + i |
|||
wend |
|||
next |
|||
end fn |
|||
fn ErdosNicolasNumbers |
|||
HandleEvents |
|||
</syntaxhighlight> |
|||
{{output}} |
|||
<pre> |
|||
24 == sum of its first 6 divisors |
|||
2016 == sum of its first 31 divisors |
|||
8190 == sum of its first 43 divisors |
|||
42336 == sum of its first 66 divisors |
|||
45864 == sum of its first 66 divisors |
|||
392448 == sum of its first 68 divisors |
|||
</pre> |
|||
=={{header|Go}}== |
=={{header|Go}}== |