Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,18 @@
include "NSLog.incl"
local fn SumOfProperDivisors( n as NSUInteger ) as NSUinteger
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

View file

@ -0,0 +1,39 @@
include "NSLog.incl"
local fn SumOfProperDivisors( n as NSUInteger ) as NSUinteger
NSUinteger i, j, sum = 1
for i = 3 to sqr(n) step 2
if ( n mod i == 0 )
sum += i
j = n/i
if ( i != j )
sum += j
end if
end if
next
end fn = sum
NSUinteger n = 1, c
while ( c < 25 )
if ( n < fn SumOfProperDivisors( n ) )
NSLog( @"%2lu: %lu", c, n )
c++
end if
n += 2
wend
while ( c < 1000 )
if ( n < fn SumOfProperDivisors( n ) ) then c++
n += 2
wend
NSLog( @"\nThe one thousandth abundant odd number is: %lu\n", n )
n = 1000000001
while ( n >= fn SumOfProperDivisors( n ) )
n += 2
wend
NSLog( @"The first abundant odd number above one billion is: %lu\n", n )
HandleEvents