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,23 @@
var [const] BI=Import("zklBigNum"); // libGMP
fcn nSmooth(n,sz){ // --> List of big ints
if(sz<1) throw(Exception.ValueError("size must be at least 1"));
bn,primes,ns := BI(n), List(), List.createLong(sz);
if(not bn.probablyPrime()) throw(Exception.ValueError("n must be prime"));
p:=BI(1); while(p<n){ primes.append(p.nextPrime().copy()) } // includes n
ns.append(BI(1));
next:=primes.copy();
if(Void!=( z:=primes.find(bn)) ) next.del(z+1,*);
indices:=List.createLong(next.len(),0);
do(sz-1){
ns.append( nm:=BI( next.reduce(fcn(a,b){ a.min(b) }) ));
foreach i in (indices.len()){
if(nm==next[i]){
indices[i]+=1;
next[i]=primes[i]*ns[indices[i]];
}
}
}
ns
}

View file

@ -0,0 +1,15 @@
smallPrimes:=List();
p:=BI(1); while(p<29) { smallPrimes.append(p.nextPrime().toInt()) }
foreach p in (smallPrimes){
println("The first 25 %d-smooth numbers are:".fmt(p));
println(nSmooth(p,25).concat(" "), "\n")
}
foreach p in (smallPrimes[1,*]){
print("The 3,000th to 3,202nd %d-smooth numbers are: ".fmt(p));
println(nSmooth(p,3002)[2999,*].concat(" "));
}
foreach p in (T(503,509,521)){
println("\nThe 30,000th to 30,019th %d-smooth numbers are:".fmt(p));
println(nSmooth(p,30019)[29999,*].concat(" "));
}