OFFSET
1,10
COMMENTS
A base-2 Fermat pseudoprime is a composite number x such that 2^x == 2 (mod x). For such an x, ord(2,x) is the smallest positive integer m such that 2^m == 1 (mod x). For a number x to have order n, it must be a factor of 2^n-1 and not be a factor of 2^r-1 for r<n. Sequence A086249 lists the number of pseudoprimes of order n.
LINKS
Max Alekseyev, Table of n, a(n) for n = 1..200
R. G. E. Pinch, Pseudoprimes and their factors (FTP)
Eric Weisstein's World of Mathematics, Pseudoprime
EXAMPLE
a(10) = 1 there is only 1 pseudoprime, 341 = 11*31, having order 10; that is, 2^10 = 1 mod 341.
MATHEMATICA
Table[d=Divisors[2^n-1]; num=0; i=1; done=False; While[m=d[[i]]; done=!PrimeQ[m]&&PowerMod[2, m, m]==2&&MultiplicativeOrder[2, m]==n; If[done, num=m]; !done&&i<Length[d], i++ ]; num, {n, 100}]
PROG
(PARI) { a(n) = fordiv(2^n-1, d, if(d>1 && (d-1)%n==0 && !ispseudoprime(d) && znorder(Mod(2, d))==n, return(d)) ); 0 } /* Max Alekseyev, Jan 07 2015 */
CROSSREFS
KEYWORD
hard,nonn
AUTHOR
T. D. Noe, Jul 14 2003
STATUS
approved