%I M2833 #32 Sep 26 2024 23:37:25
%S 3,10,21,44,83,218,271,692,865,2622,2813,9220,9735,35214,35911,135564,
%T 136899,533290,535081
%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). 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 Robert 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 Robert Haas, <a href="/A007687/a007687.pdf">Letter to N. J. A. Sloane, Aug. 1994</a>
%o (Python)
%o from itertools import product
%o def colorings(n, zp):
%o result = 0
%o for f in product(range(n), repeat=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 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,hard
%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
%E a(18)-a(19) from _Lucas A. Brown_, Sep 20 2024