login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A105222 Smallest integer m > 1 such that m^(n-1) == 1 (mod n). 5
2, 3, 2, 5, 2, 7, 2, 9, 8, 11, 2, 13, 2, 15, 4, 17, 2, 19, 2, 21, 8, 23, 2, 25, 7, 27, 26, 9, 2, 31, 2, 33, 10, 35, 6, 37, 2, 39, 14, 41, 2, 43, 2, 45, 8, 47, 2, 49, 18, 51, 16, 9, 2, 55, 21, 57, 20, 59, 2, 61, 2, 63, 8, 65, 8, 25, 2, 69, 22, 11, 2, 73, 2, 75, 26 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
Composite n are Fermat pseudoprimes to base a(n).
For n > 1; (5+(-1)^n)/2 <= a(n) <= n+(-1)^n. If n > 2 and a(n) > 2 then n is composite. - Thomas Ordowski, Dec 01 2013
LINKS
Eric Weisstein's World of Mathematics, Fermat Pseudoprime
FORMULA
a(p) = 2 for odd prime p.
EXAMPLE
We have 2^(2-1) == 0, 3^(2-1) == 1 (mod 2), so a(2) = 3.
MATHEMATICA
Table[k = 2; While[PowerMod[k, n - 1, n] != 1, k++]; k, {n, 2, 100}] (* T. D. Noe, Dec 07 2013 *)
PROG
(PARI) a(n) = {m = 2; while ((m^(n-1) % n) != lift(Mod(1, n)), m++); m; } \\ Michel Marcus, Dec 01 2013
(PARI) a(n) = my(m=2); while(Mod(m, n)^(n-1)!=1, m++); m \\ Charles R Greathouse IV, Dec 01 2013
CROSSREFS
Sequence in context: A348846 A057815 A007387 * A280503 A094757 A095171
KEYWORD
easy,nonn
AUTHOR
Max Alekseyev, Apr 14 2005
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 09:13 EDT 2024. Contains 371967 sequences. (Running on oeis4.)