OFFSET
1,1
COMMENTS
a(k-1) = k for odd composite numbers k = {9, 15, 21, 25, 27, 33, 35, 39, 45, 49, 51, ...} = A071904(n). - Alexander Adamchuk, Dec 13 2006
REFERENCES
A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 42 (but beware errors in his table for n = 28, 58, 65, 77, 100).
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
LINKS
T. D. Noe, Table of n, a(n) for n = 1..10000
G. P. Michon, Pseudoprimes
Eric Weisstein's World of Mathematics, Fermat's Little Theorem.
Wikipedia, Pseudoprime
MATHEMATICA
f[n_] := Block[{k = n + 1}, While[PrimeQ[k] || PowerMod[n, k - 1, k] != 1, k++ ]; k]; Table[ f[n], {n, 67}] (* Robert G. Wilson v, Sep 18 2004 *)
PROG
(Haskell)
import Math.NumberTheory.Moduli (powerMod)
a007535 n = head [m | m <- dropWhile (<= n) a002808_list,
powerMod n (m - 1) m == 1]
-- Reinhard Zumkeller, Jul 11 2014
(PARI) a(n)=forcomposite(m=n+1, , if(Mod(n, m)^(m-1)==1, return(m))) \\ Charles R Greathouse IV, May 18 2015
CROSSREFS
KEYWORD
nonn,nice,easy
EXTENSIONS
Corrected and extended by Patrick De Geest, October 2000
STATUS
approved