Abundant odd numbers: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 740: | Line 740: | ||
The first abundant odd number above one billion is: |
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> |
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|Delphi}}== |
|||
{{trans|C}} |
|||
<lang delphi>program AbundantOddNumbers; |
|||
{$APPTYPE CONSOLE} |
|||
uses |
|||
SysUtils; |
|||
function SumProperDivisors(const N: Cardinal): Cardinal; |
|||
var |
|||
I, J: Cardinal; |
|||
begin |
|||
Result := 1; |
|||
I := 3; |
|||
while I < Sqrt(N)+1 do begin |
|||
if N mod I = 0 then begin |
|||
J := N div I; |
|||
Inc(Result, I); |
|||
if I <> J then Inc(Result, J); |
|||
end; |
|||
Inc(I, 2); |
|||
end; |
|||
end; |
|||
var |
|||
C, N: Cardinal; |
|||
begin |
|||
N := 1; |
|||
C := 0; |
|||
while C < 25 do begin |
|||
if N < SumProperDivisors(N) then begin |
|||
Inc(C); |
|||
WriteLn(Format('%u: %u', [C, N])); |
|||
end; |
|||
Inc(N, 2); |
|||
end; |
|||
while C < 1000 do begin |
|||
if N < SumProperDivisors(N) then Inc(C); |
|||
Inc(N, 2); |
|||
end; |
|||
WriteLn(Format('The one thousandth abundant odd number is: %u', [N])); |
|||
N := 1000000001; |
|||
while N >= SumProperDivisors(N) do Inc(N, 2); |
|||
WriteLn(Format('The first abundant odd number above one billion is: %u', [N])); |
|||
end. |
|||
</lang> |
|||
{{out}} |
|||
<pre>1: 945 |
|||
2: 1575 |
|||
3: 2205 |
|||
4: 2835 |
|||
5: 3465 |
|||
6: 4095 |
|||
7: 4725 |
|||
8: 5355 |
|||
9: 5775 |
|||
10: 5985 |
|||
11: 6435 |
|||
12: 6615 |
|||
13: 6825 |
|||
14: 7245 |
|||
15: 7425 |
|||
16: 7875 |
|||
17: 8085 |
|||
18: 8415 |
|||
19: 8505 |
|||
20: 8925 |
|||
21: 9135 |
|||
22: 9555 |
|||
23: 9765 |
|||
24: 10395 |
|||
25: 11025 |
|||
The one thousandth abundant odd number is: 492977 |
|||
The first abundant odd number above one billion is: 1000000575 |
|||
</pre> |
|||
=={{header|Factor}}== |
=={{header|Factor}}== |