Created
May 17, 2025 23:03
-
-
Save Hermann-SW/e4c2ccccd918e59766dc82b01993d41b to your computer and use it in GitHub Desktop.
script demonstrating alternative for isprimepower() with very big primes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
f1(N)={isprimepower(N,&r);return(r);} | |
f2(N)={return(lift(gcd(Mod(2,N)^N-2,N)));} | |
measure(f,N)={t0=getwalltime();f(N);t1=getwalltime();return(t1-t0);} | |
print("runtimes in milliseconds, with N=nextprime(base)^expo\n"); | |
print("isprimepower(N,&r);return(r)"); | |
{ | |
printf(" |");for(e=2,15,printf("%3d|",e));print(); | |
printf(" |");for(e=2,15,print1("---|"));print(); | |
forstep(b=10,160,10, | |
printf("10^%3d|",b); | |
for(e=2,15, | |
N=nextprime(10^b)^e; | |
t=measure(f1,N); | |
printf("%3d|",t); | |
); | |
print(""); | |
) | |
} | |
print(); | |
print("lift(gcd(Mod(2,N)^N-2,N))"); | |
{ | |
printf(" |");for(e=2,15,printf("%3d|",e));print(); | |
printf(" |");for(e=2,15,print1("---|"));print(); | |
forstep(b=10,160,10, | |
printf("10^%3d|",b); | |
for(e=2,15, | |
N=nextprime(10^b)^e; | |
t=measure(f2,N); | |
printf("%3d|",t); | |
); | |
print(""); | |
) | |
} |
Author
Hermann-SW
commented
May 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment