Abundant odd numbers: Difference between revisions
Content added Content deleted
Drkameleon (talk | contribs) (Added Arturo implementation) |
No edit summary |
||
Line 2,650: | Line 2,650: | ||
Primer número impar abundante > 1 000 000 000: |
Primer número impar abundante > 1 000 000 000: |
||
1000000575 suma divisoria adecuada: 1083561009 |
1000000575 suma divisoria adecuada: 1083561009 |
||
</pre> |
|||
=={{header|FutureBasic}}== |
|||
{{trans|C}} |
|||
<lang futurebasic> |
|||
include "NSLog.incl" |
|||
local fn SumOfProperDivisors( n as NSUInteger ) as NSUinteger |
|||
'~'1 |
|||
NSUinteger sum = 1 |
|||
cln for (unsigned i = 3, j; i < sqrt(n)+1; i += 2) if (n % i == 0) sum += i + (i == (j = n / i) ? 0 : j); |
|||
end fn = sum |
|||
NSUinteger n, c |
|||
cln for (n = 1, c = 0; c < 25; n += 2 ) if ( n < SumOfProperDivisors( n ) ) NSLog( @"%2lu: %lu", ++c, n ); |
|||
cln for ( ; c < 1000; n += 2 ) if ( n < SumOfProperDivisors( n ) ) c ++; |
|||
NSLog( @"\nThe one thousandth abundant odd number is: %lu\n", n ) |
|||
cln for ( n = 1000000001 ;; n += 2 ) if ( n < SumOfProperDivisors( n ) ) break; |
|||
NSLog( @"The first abundant odd number above one billion is: %lu\n", n ) |
|||
HandleEvents |
|||
</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> |
</pre> |
||