Carmichael 3 strong pseudoprimes: Difference between revisions

m
→‎Source: Add a hint to an orphaned phrase.
m (→‎Source: Add a hint to an orphaned phrase.)
Line 490:
This is F77 style, and directly translates the given calculation as per ''formula translation''. It turns out that the normal integers suffice for the demonstration, except for just one of the products of the three primes: 41x1721x35281 = 2489462641, which is bigger than 2147483647, the 32-bit limit. Fortunately, INTEGER*8 variables are also available, so the extension is easy. Otherwise, one would have to mess about with using two integers in a bignum style, one holding say the millions, and the second the number up to a million.
===Source===
So, using the double MOD approach (see the ''Discussion'') - which gives the same result for either style of MOD... <lang Fortran> LOGICAL FUNCTION ISPRIME(N) !Ad-hoc, since N is not going to be big...
INTEGER N !Despite this intimidating allowance of 32 bits...
INTEGER F !A possible factor.
Line 530:
END DO
END</lang>
 
===Output===
<pre>
1,220

edits