login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

Numbers n such that k^(n-1) == k (mod n) for every k = 1, 2, ..., n-1.
2

%I #38 Mar 16 2024 11:19:50

%S 1,2,6,10,14,22,26,30,34,38,46,58,62,74,82,86,94,106,118,122,134,142,

%T 146,158,166,178,182,194,202,206,214,218,226,254,262,274,278,298,302,

%U 314,326,334,346,358,362,382,386,394,398,422,446,454,458,466,478,482

%N Numbers n such that k^(n-1) == k (mod n) for every k = 1, 2, ..., n-1.

%C Subsequence of, but different from A197930, for example A197930(11) = 42 with 42 distinct residues, but the set R of the residues k^41 mod 42 is R = {1, 32, 33, 16, 17, 6, …, 9, 10, 41} for k = 1, 2, …, 41 instead R = {1, 2, 3, …, 40, 41}. Terms of A197930 that are not in this sequence: 42, 78, 110, 114, 138, 170, …

%C Squarefree numbers n such that A002322(n) divides n-2. Contains all doubled odd primes and all doubled Carmichael numbers. - _Thomas Ordowski_, Apr 23 2017

%H Paolo P. Lava, <a href="/A216090/b216090.txt">Table of n, a(n) for n = 1..1000</a>

%e a(4) = 10 because x^9 == 1, 2, ..., 9 (mod 10) with 9 distinct residues such that:

%e 1^9 = 1 == 1 (mod 10);

%e 2^9 = 512 == 2 (mod 10);

%e 3^9 = 19683 == 3 (mod 10);

%e 4^9 = 262144 == 4 (mod 10);

%e 5^9 = 1953125 == 5 (mod 10);

%e 6^9 = 10077696 == 6 (mod 10);

%e 7^9 = 40353607 == 7 (mod 10);

%e 8^9 = 134217728 == 8 (mod 10);

%e 9^9 = 387420489 == 9 (mod 10).

%p with(numtheory):for n from 1 to 500 do:j:=0:for i from 1 to n do: if irem(i^(n-1),n)=i then j:=j+1:else fi:od:if j=n-1 then printf(`%d, `, n):else fi:od:

%t f[n_] := And @@ Table[PowerMod[k, n - 1, n] == k, {k, n - 1}]; Select[Range[500], f] (* _T. D. Noe_, Sep 03 2012 *)

%o (PARI) isok(n) = {for (k=1, n-1, if (Mod(k, n)^(n-1) != Mod(k, n), return (0));); return (1);} \\ _Michel Marcus_, Apr 23 2017

%o (Python)

%o from sympy.ntheory.factor_ import core

%o from sympy import primefactors

%o def ok(n):

%o if n<3: return True

%o if core(n) == n:

%o for p in primefactors(n):

%o if (n - 2)%(p - 1): return False

%o return True

%o return False

%o print([n for n in range(1, 501) if ok(n)]) # _Indranil Ghosh_, Apr 23 2017

%Y Subsequence of A192109.

%Y Terms > 2 form a subsequence of A050990.

%Y Cf. A197929, A197930, A197943.

%K nonn

%O 1,2

%A _Michel Lagneau_, Sep 01 2012