Abundant odd numbers: Difference between revisions

Added XPL0 example.
(Added XPL0 example.)
Line 6,294:
The first abundant odd number above one billion is:
1000000575 < 1 + 3 + 5 + 7 + 9 + 15 + 21 + 25 + 35 + 45 + 49 + 63 + 75 + 105 + 147 + 175 + 225 + 245 + 315 + 441 + 525 + 735 + 1225 + 1575 + 2205 + 3675 + 11025 + 90703 + 272109 + 453515 + 634921 + 816327 + 1360545 + 1904763 + 2267575 + 3174605 + 4081635 + 4444447 + 5714289 + 6802725 + 9523815 + 13333341 + 15873025 + 20408175 + 22222235 + 28571445 + 40000023 + 47619075 + 66666705 + 111111175 + 142857225 + 200000115 + 333333525 = 1083561009
</pre>
 
=={{header|XPL0}}==
<lang XPL0>int Cnt, Num, Div, Sum, Quot;
[Cnt:= 0;
Num:= 3; \find odd abundant numbers
loop [Div:= 1;
Sum:= 0;
loop [Quot:= Num/Div;
if Div > Quot then quit;
if rem(0) = 0 then
[Sum:= Sum + Div;
if Div # Quot then Sum:= Sum + Quot;
];
Div:= Div+2;
];
if Sum > 2*Num then
[Cnt:= Cnt+1;
if Cnt<=25 or Cnt>=1000 then
[IntOut(0, Num); ChOut(0, 9);
IntOut(0, Sum); CrLf(0);
if Cnt = 1000 then Num:= 1_000_000_001 - 2;
if Num > 1_000_000_000 then quit;
];
];
Num:= Num+2;
];
]</lang>
 
{{out}}
<pre>
945 1920
1575 3224
2205 4446
2835 5808
3465 7488
4095 8736
4725 9920
5355 11232
5775 11904
5985 12480
6435 13104
6615 13680
6825 13888
7245 14976
7425 14880
7875 16224
8085 16416
8415 16848
8505 17472
8925 17856
9135 18720
9555 19152
9765 19968
10395 23040
11025 22971
492975 1012336
1000000575 2083561584
</pre>
 
296

edits