login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = n^n mod (n+2).
6

%I #29 Oct 23 2024 18:02:15

%S 1,1,0,2,4,3,0,7,6,5,4,6,8,13,0,8,16,9,4,19,12,11,16,17,14,7,4,14,16,

%T 15,0,31,18,13,16,18,20,37,24,20,16,21,4,7,24,23,16,17,6,49,4,26,34,3,

%U 8,55,30,29,4,30,32,61,0,57,16,33,4,67,46,35,16,36,38

%N a(n) = n^n mod (n+2).

%C Conjectures:

%C 1. Indices of zeros: 2^(x+2)-2, x >= 0.

%C 2. a(n)=n if n is in A176003.

%C 3. Every integer k >= 0 appears in a(n) at least once.

%C 4. Every k >= 0 appears in a(n) infinitely many times.

%C From _Robert Israel_, May 05 2015: (Start)

%C Conjecture 1) is true: with m = n+2, a(n) = (-2)^(m-2) mod m = 0 iff m divides 2^(m-2), i.e., m = 2^k for some k with k <= m-2 (which is true for k >= 2).

%C Conjecture 2) is true: if n = 3*p-2 where p is prime, then n == 1 (mod 3) so n^n == n (mod 3), and n^(p-1) == 1 (mod p) so n^n == n (mod p), and therefore (if p <> 3) n^n == n (mod 3*p). A separate computation verifies the case p=3.

%C If p is an odd prime, then a(p+2) = (p-1)/2. (End)

%H Paolo P. Lava, <a href="/A213381/b213381.txt">Table of n, a(n) for n = 0..1000</a>

%F a(n) = (n^n) mod (n+2).

%F a(n) = (-2)^n mod (n+2). - _Robert Israel_, May 05 2015

%e a(5) = 5^5 mod 7 = 3125 mod 7 = 3.

%t a[n_] := PowerMod[-2, n, n+2];

%t a /@ Range[0, 100] (* _Jean-François Alcover_, Jun 04 2020 *)

%t Table[PowerMod[n,n,n+2],{n,0,80}] (* _Harvey P. Dale_, Oct 23 2024 *)

%o (PARI) a(n) = lift(Mod(n, n+2)^n); \\ _Michel Marcus_, Jun 04 2020

%Y Cf. A000312.

%K nonn

%O 0,4

%A _Alex Ratushnyak_, Jun 10 2012