Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
32
Task/Proper-divisors/FutureBasic/proper-divisors.basic
Normal file
32
Task/Proper-divisors/FutureBasic/proper-divisors.basic
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
local fn ProperDivisors( n as long ) as CFArrayRef
|
||||
CFMutableArrayRef array = fn MutableArrayWithCapacity(0)
|
||||
if ( n < 2 ) then exit fn
|
||||
long i
|
||||
for i = 1 to n - 1
|
||||
if ( n mod i == 0 )
|
||||
MutableArrayAddObject( array, @(i) )
|
||||
end if
|
||||
next
|
||||
end fn = array
|
||||
|
||||
void local fn DoIt
|
||||
long n, count, num, max = 0
|
||||
|
||||
for n = 1 to 10
|
||||
printf @"%2ld: %@",n,fn ArrayComponentsJoinedByString( fn ProperDivisors( n ), @" " )
|
||||
next
|
||||
|
||||
for n = 1 to 20000
|
||||
count = len( fn Properdivisors( n ) )
|
||||
if ( count > max )
|
||||
max = count
|
||||
num = n
|
||||
end if
|
||||
next
|
||||
|
||||
print: print num;@" has the most proper divisors with ";max
|
||||
end fn
|
||||
|
||||
fn DoIt
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue