Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,4 @@
|
|||
fcn properDivs(n){ [1.. (n + 1)/2 + 1].filter('wrap(x){ n%x==0 and n!=x }) }
|
||||
fcn aliquot(k){ //-->Walker
|
||||
Walker(fcn(rk){ k:=rk.value; if(k)rk.set(properDivs(k).sum()); k }.fp(Ref(k)))
|
||||
}(10).walk(15).println();
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fcn aliquot(k){ //-->Walker
|
||||
Walker(fcn(rk){
|
||||
k:=rk.value;
|
||||
rk.set((1).reduce((k + 1)/2, fcn(s,n,k){
|
||||
s + (k%n==0 and k!=n and n) // s + False == s + 0
|
||||
},0,k));
|
||||
k
|
||||
}.fp(Ref(k)))
|
||||
}(10).walk(15).println();
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
fcn classify(k){
|
||||
const MAX=(2).pow(47); // 140737488355328
|
||||
ak,aks:=aliquot(k), ak.walk(16);
|
||||
_,a2,a3:=aks;
|
||||
if(a2==k) return("perfect");
|
||||
if(a3==k) return("amicable");
|
||||
aspiring:='wrap(){
|
||||
foreach n in (aks.len()-1){ if(aks[n]==aks[n+1]) return(True) }
|
||||
False
|
||||
};
|
||||
cyclic:='wrap(){
|
||||
foreach n in (aks.len()-1){ if(aks[n+1,*].holds(aks[n])) return(aks[n]) }
|
||||
False
|
||||
};
|
||||
(if(aks.filter1('==(0))!=False) "terminating"
|
||||
else if(n:=aks[1,*].filter1n('==(k))) "sociable of length " + (n+1)
|
||||
else if(aks.filter1('>(MAX))) "non-terminating"
|
||||
else if(aspiring()) "aspiring"
|
||||
else if((c:=cyclic())!=False) "cyclic on " + c
|
||||
else "non-terminating" )
|
||||
+ " " + aks.filter();
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
[1..10].pump(fcn(k){ "%6d is %s".fmt(k,classify(k)).println() });
|
||||
T(11,12,28,496,220,1184,12496,1264460,790,909,562,1064,1488)
|
||||
.pump(fcn(k){ "%6d is %s".fmt(k,classify(k)).println() });
|
||||
Loading…
Add table
Add a link
Reference in a new issue