login
a(n) = (Sum(m^(n-1), m=1..n-1) + 1) modulo n.
6

%I #13 Sep 23 2016 09:25:12

%S 0,0,0,1,0,4,0,1,7,6,0,1,0,8,11,1,0,10,0,1,15,12,0,1,21,14,19,1,0,16,

%T 0,1,23,18,1,1,0,20,27,1,0,22,0,1,22,24,0,1,43,26,35,1,0,28,1,1,39,30,

%U 0,1,0,32,43,1,53,34,0,1,47,36,0,1,0,38,51,1,1

%N a(n) = (Sum(m^(n-1), m=1..n-1) + 1) modulo n.

%C Equals 0 if n is 1 or a prime, by Fermat's little theorem. It is conjectured that the converse is also true; see A055030, A055032, A204187 and note that a(n) = 0 <==> A055032(n) = 1 <==> A204187(n) = n-1.

%D R. K. Guy, Unsolved Problems in Number Theory, A17.

%H Ivan Neretin, <a href="/A201560/b201560.txt">Table of n, a(n) for n = 1..10000</a>

%F a(prime) = 0 and a(4n) = 1.

%F a(n) == A204187(n) + 1 (mod n).

%e Sum(m^3, m=1..3) + 1 = 1^3 + 2^3 + 3^3 + 1 = 37 == 1 (mod 4), so a(4) = 1.

%t Table[Mod[Plus @@ PowerMod[Range[n - 1], n - 1, n] + 1, n], {n, 77}] (* _Ivan Neretin_, Sep 23 2016 *)

%Y Cf. A055023, A055030, A055031, A055032, A204187.

%K nonn

%O 1,6

%A _Jonathan Sondow_, Jan 11 2012