Data update
This commit is contained in:
parent
8e4e15fa56
commit
72eb4943cb
1853 changed files with 35514 additions and 9441 deletions
|
|
@ -0,0 +1,95 @@
|
|||
begin globals
|
||||
short n
|
||||
long arr(17)
|
||||
bool gStop = _False
|
||||
end globals
|
||||
|
||||
local fn sumFactors(nx as long) as long
|
||||
long i, sumFactor
|
||||
sumFactor = 0
|
||||
for i = 1 to fix(nx / 2)
|
||||
if (nx) mod i = 0 then sumFactor = sumFactor + i
|
||||
next
|
||||
end fn = sumFactor
|
||||
|
||||
void local fn printSeries(arrx as short, size as short, type as str255)
|
||||
short i = 0
|
||||
print
|
||||
print "Integer" + str$(arrx) + ", Type: " + type + ", Series: ";
|
||||
for i=0 to size - 2
|
||||
print str$(arr(i)) + " ";
|
||||
next i
|
||||
end fn
|
||||
|
||||
local fn Aliquot(nx as long)
|
||||
|
||||
short i, j
|
||||
str255 type
|
||||
|
||||
type = "Sociable"
|
||||
arr(0) = nx
|
||||
|
||||
for i = 1 to 15
|
||||
|
||||
arr(i) = fn sumFactors(arr(i-1))
|
||||
if (arr(i)=0 || arr(i)=nx || (arr(i) = arr(i-1)) && arr(i)<>nx)
|
||||
if arr(i) = 0
|
||||
type = "Terminating"
|
||||
else
|
||||
if arr(i) = nx && i = 1
|
||||
type = "Perfect"
|
||||
else
|
||||
if arr(i) = nx && i = 2
|
||||
type = "Amicable"
|
||||
else
|
||||
if arr(i) = arr(i-1) && arr(i)<>nx
|
||||
type = "Aspiring"
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
fn printSeries(arr(0),i+1,type)
|
||||
if type = "Terminating"
|
||||
print " 0"
|
||||
else
|
||||
print
|
||||
end if
|
||||
|
||||
exit fn
|
||||
end if
|
||||
|
||||
|
||||
for j = 1 to i-1
|
||||
if arr(j) = arr(i)
|
||||
fn printSeries(arr(0),i+1,"Cyclic")
|
||||
print
|
||||
exit fn
|
||||
end if
|
||||
next j
|
||||
next i
|
||||
fn printSeries(arr(i),i+1,"Non-Terminating")
|
||||
print
|
||||
|
||||
end fn
|
||||
|
||||
|
||||
local fn DoAliquot
|
||||
// declare and assign c-type array
|
||||
long dataArray(30) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 28, 496, 220, 1184,¬
|
||||
12496, 1264460, 790, 909, 562, 1064, 1488, 0}
|
||||
|
||||
short i
|
||||
for i = 0 to 24
|
||||
if dataArray(i) = 0 then gStop = _True:exit fn
|
||||
fn Aliquot(dataArray(i))
|
||||
next i
|
||||
|
||||
end fn = gStop
|
||||
|
||||
window 1,@"Aliquot sequence classifications",fn CGRectMake(0, 0, 1150, 700)
|
||||
windowcenter(1)
|
||||
|
||||
fn AppSetTimer( .000001, @Fn DoAliquot, _true )
|
||||
|
||||
handleevents
|
||||
Loading…
Add table
Add a link
Reference in a new issue