02-06-2013, 03:40 AM
tweaked it a little array only populated now with the exact amount of elements it needs to hold divisor numbers.
Function find_perfect_numbers3
You May have to change array type as u get into larger numbers though.but this is not the best way to test either and is limited in how far it can go.
http://www.mersenne.org/ has software just for doing this
Function find_perfect_numbers3
int sn cn ii fnc i
sn=1500000
ARRAY(int) pnc
cn=1
for ii cn sn
,if !(sn%cn)
,,pnc[]=cn
,,out pnc[i]
,,fnc=fnc+pnc[i]
,,i+1
,cn+1
fnc=fnc+sn/2
if fnc=sn
,out "perfect number"
else
,out "not pefect number"
You May have to change array type as u get into larger numbers though.but this is not the best way to test either and is limited in how far it can go.
http://www.mersenne.org/ has software just for doing this