This file contains 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
#include <cstdlib> | |
#include <iostream> | |
#include <math.h> | |
#include "Miniball.hpp" | |
// from https://people.inf.ethz.ch/gaertner/subdir/software/miniball.html | |
/* | |
$ g++ miniball_int.cpp -O3 -o miniball_int | |
$ | |
*/ | |
int main (int argc, char* argv[]) |
This file contains 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
assert(b)=if(!(b),error()); | |
SquaresRepresentations(n,k,a=0)={ | |
my(R=List(),m=sqrtint(n\k)); | |
if(k==1,return(if(m>=a&&n==m^2,[m],[]))); | |
for(b=a,m,foreach(SquaresRepresentations(n-b^2,k-1,b),s,listput(R,concat([b],s)))); | |
Vec(R); | |
} | |
signs(a)={ |
This file contains 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
{[ | |
2022202116, | |
1777034894, | |
1000032472, | |
399866798, | |
314187728, | |
271643232, | |
232050760, | |
231583998, | |
231295516, |
This file contains 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
F__={[\\ needs parisizemax >= 600M; from http://www.prothsearch.com/fermat.html | |
[3], \\ F0 | |
[5], | |
[17], | |
[257], | |
[65537], | |
[641, 6700417], | |
[274177, 67280421310721], | |
[59649589127497217, 5704689200685129054721], | |
[1238926361552897, "P62"], |
This file contains 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
{[ | |
"10^2000007-10^1127194-10^872812-1", | |
"10^2000005-10^1051046-10^948958-1", | |
"10^1888529-10^944264-1", | |
"10^1234567-20342924302*10^617278-1", | |
"10^1234567-1927633367291*10^617277-1", | |
"10^1234567-3626840486263*10^617277-1", | |
"10^1234567-4708229228074*10^617277-1", | |
"10^490000+3*(10^7383-1)/9*10^241309+1", | |
"10^474500+999*10^237249+1", |
This file contains 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
/* | |
https://www.mersenneforum.org/showthread.php?t=29584 | |
Factors 300 decimal digits semiprime n, knowing its prime factors consist of | |
digits 3 and 7 only, 10,000 times in less than 1s in total on 7950X CPU. | |
f=puzzle | |
g++ -O3 -Wall -Wextra -pedantic $f.cc -o $f -lgmp -lgmpxx | |
cpplint --filter=-legal/copyright,-runtime/references $f.cc | |
cppcheck --enable=all --suppress=missingIncludeSystem $f.cc --check-config |
This file contains 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
P=extern("curl -s https://oeis.org/A080076/a080076.json.txt"); | |
p2=eval(getenv("p2")); | |
r=eval(getenv("r")); | |
doit(r)={ | |
for(m=r[1],r[2], | |
cnt=Vec(0,2^p2); | |
foreach(P,p,if(2^m<p&&p<2^(2*m),cnt[1+(p>>m)>>(m-p2)]++)); | |
print(m," ",cnt," (0..",2^(p2)-1,") vecsum=",vecsum(cnt)); | |
) |
This file contains 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
\\ detemine count of Proth primes until environment n | |
\\ environment l (loops) allows to tune work distribution | |
\\ | |
\\ based on Karim's isProth2(): | |
\\ https://pari.math.u-bordeaux.fr/archives/pari-users-2403/msg00064.html | |
\\ and Bill's parallel implementation: | |
\\ https://pari.math.u-bordeaux.fr/archives/pari-users-2403/msg00067.html | |
\\ | |
isProth2(p) = !(p >> (valuation(p-1,2)<<1)); | |
export(isProth2); |
This file contains 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
//======================================================================= | |
// Distributed under the Boost Software License, Version 1.0. (See | |
// accompanying file LICENSE_1_0.txt or copy at | |
// http://www.boost.org/LICENSE_1_0.txt) | |
/* | |
f=dot2leda | |
g++ -O3 -Wall -pedantic -Wextra $f.cpp -o $f -lboost_graph | |
cpplint --filter=-legal/copyright,-build/namespaces $f.cpp | |
cppcheck --enable=all --suppress=missingIncludeSystem $f.cpp --check-config | |
*/ |
This file contains 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
//======================================================================= | |
// Distributed under the Boost Software License, Version 1.0. (See | |
// accompanying file LICENSE_1_0.txt or copy at | |
// http://www.boost.org/LICENSE_1_0.txt) | |
/* | |
f=straight_line_graphviz | |
g++ -O3 -Wall -pedantic -Wextra $f.cpp -o $f | |
cpplint --filter=-legal/copyright,-build/namespaces $f.cpp | |
cppcheck --enable=all --suppress=missingIncludeSystem $f.cpp --check-config | |
*/ |
NewerOlder