An OpenPFGW script that does a partial Miller-Rabin test on a large number

I’m posting this so I can refer to it later. The number being tested is n=(82065^19937 -1)/(82065-1). This is one part of a Miller-Rabin strong primality test. One checks that diff is -1, then one replaces the 32 on line 3 of the script by 16, and the value of res ought to be 1. Miller-Rabin strong primality test at Wikipedia: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test . The OpenPFGW software, available for download: https://sourceforge.net/projects/openpfgw/

SCRIPT
DIM xx,(82065^19937 -1)/(82065-1)
DIM x2,((82065^19937 -1)/(82065-1)-1)/32
DIM base,3207170733475472351039832686350065599459652181714199927744788032412300337669571186035575395395662709
DIM res
DIM diff
POWMOD res,base,x2,xx
SET diff,res-xx
:PRINT base
:PRINT x2
PRINT xx
PRINT res
PRINT diff

Published
Categorized as History
meditationatae's avatar

By meditationatae

Canadian

Discover more from meditationatae

Subscribe now to keep reading and get access to the full archive.

Continue reading