Miller–Rabin primality test: Difference between revisions

→‎{{header|PARI/GP}}: add built-in test
(→‎{{header|PARI/GP}}: extra credit)
(→‎{{header|PARI/GP}}: add built-in test)
Line 767:
 
=={{header|PARI/GP}}==
Built-in test:
<lang parigp>sprpRandomBase(n)=ispseudoprime(n,1);</lang>
 
Custom function:
<lang parigp>sprp(n,b)={
my(s = valuation(n-1, 2), d = Mod(b, n)^(n >> s));