%I M2833 #24 Aug 26 2022 19:55:00
%S 3,10,21,44,83,218,271,692,865,2622,2813,9220,9735,35214,35911,135564,
%T 136899
%N Number of 4-colorings of cyclic group of order n.
%C The number of 2-colorings of Z_n is A000034(n-1), the number of 3-colorings of Z_n is A005843(n). It seems that the number of n-colorings of Z_2 is A137928(n-1). - _Andrey Zabolotskiy_, Oct 02 2017
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H R. Haas, <a href="https://doi.org/10.2307/2690938">Three-colorings of finite groups or an algebra of nonequalities</a>, Math. Mag., 63 (1990), 211-225.
%H R. Haas, <a href="/A007687/a007687.pdf">Letter to N. J. A. Sloane, Aug. 1994</a>
%o (Python)
%o def colorings(n, zp):
%o result = 0
%o f = [0]*zp
%o for i in range(n**zp):
%o for j1 in range(zp):
%o for j2 in range(zp):
%o if (f[j1]+f[j2])%n == f[(j1+j2)%zp]:
%o break
%o else:
%o continue
%o break
%o else:
%o result += 1
%o f[0] += 1
%o for j in range(zp-1):
%o if f[j] == n:
%o f[j] = 0
%o f[j+1] += 1
%o return result
%o print([colorings(4, k) for k in range(1, 12)])
%o # _Andrey Zabolotskiy_, Jul 12 2017
%Y Cf. A007688.
%K nonn,more
%O 1,1
%A _N. J. A. Sloane_
%E a(6)-a(11) from _Andrey Zabolotskiy_, Jul 12 2017
%E a(12)-a(17) from _Andrey Zabolotskiy_, Oct 02 2017
|