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,s)=if(!(b), error(Str(s))); | |
m=eval(getenv("m")); | |
b=m.mod; | |
c=lift(m); | |
if(ispseudoprime(c),s=sqrt(Mod(-b,c)),issquare(Mod(b,-c),&s)); | |
V=r=lift(s);; | |
print("V=",r); |
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,s)=if(!(b), error(Str(s))); | |
dbg(a,b,c="")=if(getenv("dbg"),print(a,b,c)); | |
get_tqf(n,vstart)={ | |
assert(n%4!=0); | |
assert(n%8!=7); | |
my(Q,v,b,p,a12); | |
if(n%4==2, | |
for(vv=vstart,oo, |
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,q -> a,b,c,d with a^2+b^2+c^2+d^2==p*q | |
// | |
// f=foursquare | |
// | |
// g++ $f.cc -lgmp -lgmpxx -O3 -o $f -lpari -DPARI -Wall -Wextra -pedantic | |
// | |
// $ ./$f 999999999999999999999999999989 999999999999999999999999999983 | |
// R = qfsolve(M) | |
// 2.85703s | |
// 223605138439657340220247124809 147944036070869714718268156597 314020169936458430849348767399 910771451642793118995923538064 |
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
# pylint: disable=C0103, R1728 | |
# invalid-name, consider-using-generator | |
""" blacked and pylinted; https://mersenneforum.org/showthread.php?t=22915 """ | |
import sys | |
from sys import argv, stderr | |
from math import isqrt | |
N = 15 if len(argv) < 2 else int(argv[1]) | |
a = [[] for i in range(N + 1)] | |
stop = len(argv) >= 3 |
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
\r RSA_numbers_factored.gp | |
test(v)= | |
{ | |
if(#v<4, | |
break()); | |
my([l,n,p,q]=v,pnr,qnr,sqrtm1); | |
if ((p%4!=1)||(q%4!=1), | |
break()); | |
forprime(t=2,oo, |
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
#!/bin/bash | |
if [[ "$3" != '' ]] | |
then | |
for((i=1; i<=$3; ++i)) | |
do | |
$0 "$1" "$2" & | |
done | |
exit | |
fi |
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
# pylint: disable=C0103 (invalid-name) | |
""" | |
python range_server.py port start stop | |
""" | |
from socketserver import TCPServer | |
from http.server import SimpleHTTPRequestHandler | |
from threading import Thread | |
from timeit import default_timer | |
from time import strftime, gmtime | |
from sys import argv, stdout |
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
#!/bin/bash | |
p="" | |
date | |
echo "=======================" | |
./cado-nfs.py $1 | |
while [ $? -ne 0 ] | |
do | |
date | |
echo "=======================" |
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
// eslinted; send wakeonlan magic packet for mac address defined in m | |
// | |
const m = Buffer.from([0x9c, 0x6b, 0x00, 0x15, 0xbd, 0xc2]); | |
const p = Buffer.concat([Buffer.alloc(6,0xff),m,m,m,m,m,m,m,m,m,m,m,m,m,m,m,m]); | |
const sock = require('dgram').createSocket('udp4').on('listening', function() { | |
sock.setBroadcast(true); | |
sock.send(p, 0, p.length, 9, '255.255.255.255', function() { | |
sock.close(); | |
}); |
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
#!/bin/bash | |
wget -O /tmp/all.txt https://t5k.org/primes/lists/all.txt 2> /dev/null | |
if [ ! -f t5k.org_primes_lists_all.txt ] | |
then | |
echo "initial download of largest primes list" | |
cp /tmp/all.txt t5k.org_primes_lists_all.txt | |
fi | |
if [ ! -f t5k.org_primes_lists_all.txt.old ] |