Abundant odd numbers: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (Added Arturo implementation) |
|||
Line 1,690: | Line 1,690: | ||
Program normal end. |
Program normal end. |
||
</pre> |
</pre> |
||
=={{header|Arturo}}== |
|||
<lang rebol>abundant?: function [n]-> (2*n) < sum factors n |
|||
print "the first 25 abundant odd numbers:" |
|||
[i, found]: @[new 1, new 0] |
|||
while [found<25][ |
|||
if abundant? i [ |
|||
inc 'found |
|||
print [i "=> sum:" sum factors i] |
|||
] |
|||
'i + 2 |
|||
] |
|||
[i, found]: @[new 1, new 0] |
|||
while [found<1000][ |
|||
if abundant? i [ |
|||
inc 'found |
|||
] |
|||
'i + 2 |
|||
] |
|||
print ["the 1000th abundant odd number:" i-2 "=> sum:" sum factors i-2] |
|||
i: new 1 + 10^9 |
|||
while ø [ |
|||
if abundant? i [ |
|||
print ["the first abundant odd number greater than one billion (10^9):" i "=> sum:" sum factors i] |
|||
break |
|||
] |
|||
'i + 2 |
|||
]</lang> |
|||
{{out}} |
|||
<pre>the first 25 abundant odd numbers: |
|||
945 => sum: 1920 |
|||
1575 => sum: 3224 |
|||
2205 => sum: 4446 |
|||
2835 => sum: 5808 |
|||
3465 => sum: 7488 |
|||
4095 => sum: 8736 |
|||
4725 => sum: 9920 |
|||
5355 => sum: 11232 |
|||
5775 => sum: 11904 |
|||
5985 => sum: 12480 |
|||
6435 => sum: 13104 |
|||
6615 => sum: 13680 |
|||
6825 => sum: 13888 |
|||
7245 => sum: 14976 |
|||
7425 => sum: 14880 |
|||
7875 => sum: 16224 |
|||
8085 => sum: 16416 |
|||
8415 => sum: 16848 |
|||
8505 => sum: 17472 |
|||
8925 => sum: 17856 |
|||
9135 => sum: 18720 |
|||
9555 => sum: 19152 |
|||
9765 => sum: 19968 |
|||
10395 => sum: 23040 |
|||
11025 => sum: 22971 |
|||
the 1000th abundant odd number: 492975 => sum: 1012336 |
|||
the first abundant odd number greater than one billion (10^9): 1000000575 => sum: 2083561584</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |
||
<lang AutoHotkey>Abundant(num){ |
<lang AutoHotkey>Abundant(num){ |