Z<-LI.D4F
|Long integer routines
Z<-ADD_ALIAS LI.D4S
"LI.D4S"
edli|WW.ED"li.d4f ",ARGS
ldli|#copy"li.d4f" & LI.D4F
li_info|3 #sed"X:d;$ li.inf" & Z<-WW.FSCR 3
factorize|G<-P_FACTORS H<-ARGS & G
fretry|Z<-TEST_FILE ARGS
rsanum|Z<-#sstomat _CR,LOAD"rsac.num" & RSA_NUM<-Z[2+?7]YDX _1
ligo|SEL.FILE "*.num"
et|T0<-24 60 60 b 3 d #ts & 0 r DO ARGS & T1<-24 60 60 b 3 d #ts & "et=",8 z T1-T0
indent|IN<-#fi ARGS; LC<-#sed"." & $T[LC+iIN[0]]<-(INr" "),$T[LC+iIN[0]]
smtest|Z<-SM_TEST ARGS
"li.inf">>EOF
Some routines for 32-bit integers for complete factorisation.
See Pollard's rho-method of finding factors. This was discovered
around 1976, and is very simple to program. The method has a striking
similarity to the generation of Mandelbrot set images. The same
dynamic system z<-z^2+c is used in both algorithms.
EOF
"pema.lnk">>EOF
rfc2313 RSA Laboratories
The RSA challenge numbers
jobzap.htm
factor.txt
EOF
Z<-RSA_SELECT STR
|get rsa number by name
Z<-0 #sed":r rsac.num"
->(0=r Z<-#nfind STR)/0
Z<-$T[1tZ] YDX _1
Z<-FACTORS N;X
Z<-(Z>0)/Z<-(0=N #mod X)*X<-1+i "N" #av 1+#sqrt N
Z<-PRIMES N
|Generate prime numbers less than N
Z<-(2=+/y0=N #outer #mod 1+N)/N<-iN
Z<-PRIMES_IN LST
|Extract primes in list
Z<-(2=+/y0=LST #outer #mod 1+ic/LST)/LST
R<-SIEVE N;J;K;Z
|SIEVE OF ERASTOTHENES FOR ODD PRIMES
|Get odd primes up to 2*N
R<-(1,N-1)/"10" & Z<-iJ<-0
WHILE (J*J)<2*N;Z<-Z,K<-Ri"0";R[K+J*i(N+J-K+1)%J<-1+2*K]<-"1";WEND
R[Z]<-"0" & R<-1+2*(R="0")/iN
R<-B_SIEVE BLOC;C;I;K;MAX;MIN;N;P
|STRIKE OUT ARITHMETIC PROGRESSIONS FROM A BLOCK.
|This is useful even for powerful computers
|Example: P B_SIEVE START,SIZE
MIN<-BLOC[0]
MAX<-MIN + N<- BLOC[1]
IF 0 = #nc "P"; P<-2,SIEVE 1+ ("N" #av #sqrt MAX+1)%2
I<-0; R<-Nr"0"
WHILE I