A000790 Primary pretenders: least composite c such that n^c == n (mod c).
4, 4, 341, 6, 4, 4, 6, 6, 4, 4, 6, 10, 4, 4, 14, 6, 4, 4, 6, 6, 4, 4, 6, 22, 4, 4, 9, 6, 4, 4, 6, 6, 4, 4, 6, 9, 4, 4, 38, 6, 4, 4, 6, 6, 4, 4, 6, 46, 4, 4, 10, 6, 4, 4, 6, 6, 4, 4, 6, 15, 4, 4, 9, 6, 4, 4, 6, 6, 4, 4, 6, 9, 4, 4, 15, 6, 4, 4, 6, 6, 4, 4, 6, 21, 4, 4, 10, 6, 4
Offset: 0
Examples
a(2) = 341 because 2^341 == 2 (mod 341) and there is no smaller composite number c such that 2^c == 2 (mod c). a(3) = 6 because 3^6 == 3 (mod 6) (whereas 3^4 == 1 (mod 4)).
Links
- T. D. Noe, Table of n, a(n) for n = 0..10000
- John H. Conway, Richard K. Guy, W. A. Schneeberger and N. J. A. Sloane, The Primary Pretenders, Acta Arith. 78 (1997), 307-313.
- Steven Finch, The On-Line Encyclopedia of Integer Sequences, founded in 1964 by N. J. A. Sloane, A Tribute to John Horton Conway, The Mathematical Intelligencer (2021) Vol. 43, 146-147.
- A. Rotkiewicz, Periodic sequences of pseudoprimes connected with Carmichael numbers and the least period of the function lx^C, Acta Arith. XCI.1 (1999), 75-83.
- A. Schinzel, Sur les nombres composés n qui divisent a^n - a, Rend. Circ. Mat. Palermo (2) 7 (1958), 37-41.
- W. Sierpiński, A remark on composite numbers m which are factors of a^m - a, Wiadom. Mat. 4 (1961), 183-184 (in Polish; MR 23#A87).
- OEIS Index to periodic sequences.
Crossrefs
Programs
-
Haskell
import Math.NumberTheory.Moduli (powerMod) a000790 n = head [c | c <- a002808_list, powerMod n c c == mod n c] -- Reinhard Zumkeller, Jul 11 2014
-
Maple
f:= proc(n) local c; for c from 4 do if not isprime(c) and n &^ c - n mod c = 0 then return c fi od end proc: map(f, [$0..100]); # Robert Israel, Jan 21 2018
-
Mathematica
a[n_] := For[c = 4, True, c = If[PrimeQ[c + 1], c + 2, c + 1], If[PowerMod[n, c, c] == Mod[n, c], Return[c]]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Oct 18 2013 *)
-
PARI
a(n)=forcomposite(c=4,554,if(Mod(n,c)^c==n,return(c))); 561 \\ Charles R Greathouse IV, Feb 23 2014
-
Python
from sympy import isprime def A000790(n): c = 4 while pow(n,c,c) != (n % c) or isprime(c): c += 1 return c # Chai Wah Wu, Apr 02 2021
Comments