Talk:Miller–Rabin primality test: Difference between revisions

(→‎Run Basic and PureBasic problems with output: Kung Pow: A Fistful of Overflows)
 
(2 intermediate revisions by 2 users not shown)
Line 63:
 
::::: Given n = 31, if we select a base of 22 then it does x = (22^15) % 31 and gets -8 as the result (instead of 30 = n-1). Similar with base 27. The Pow operation overflows very easily, so the program isn't very useful as written. It needs a powmod using a ladder (see the C deterministic code or the Go code, for examples). [[User:Danaj|Danaj]] ([[User talk:Danaj|talk]]) 07:22, 12 March 2016 (UTC)
==Pseudocode in task description==
The pseudocode includes the line "for r = 1 .. s − 1". Where is r used?--[[User:Nigel Galloway|Nigel Galloway]] ([[User talk:Nigel Galloway|talk]]) 17:26, 20 August 2019 (UTC)
: It's not, so I have updated the pseudocode replacing the '''for r''' loop with a '''repeat s-1 times''' loop. -- [[User:Markjreed|Markjreed]] ([[User talk:Markjreed|talk]]) 17:05, 28 November 2021 (UTC)
 
== Pari/GP ==
 
An extension of Pari code thru consecutive bases, where sprp is per the article. Allows confirmation of 341550071728321 passing bases 2,3,5,7,11,13,17 as well as 3215031751 with 2,3,5,7 (OEIS A074773) eg MR(3215031751,2,7).
::''MR(n,blo,bhi)={prodd=1;ctr=0;
::forprime(b=blo,bhi,ctr+=1;
::prodd= prodd* sprp(n,b); \\SO, any 0 will clear it ...
::if(prodd==0,break));
::print(prodd, " ",ctr);}''
<br>--[[User:Billymacc|Billymacc]] ([[User talk:Billymacc|talk]]) 16:53, 13 July 2021 (UTC)
1,479

edits