%I #52 Dec 05 2019 04:21:08
%S 0,1,1,1,1,2,3,6,10,18,31,59,105,198,365,688,1285,2438,4599,8755,
%T 16647,31806,60787,116570,223696,430290,828514,1598025,3085465,
%U 5965612,11545611,22370304,43383539,84216330,163617801,318148208,619094385,1205609454,2349383925,4581307186,8939118925,17452582356
%N Number of ZnS polytypes that repeat after n layers.
%C Also the number of orbits of the symmetric group S3 action on irreducible polynomials of degree n>1 over GF(2). [_Jean Francis Michon_, Philippe Ravache (philippe.ravache(AT)univ-rouen.fr), Oct 04 2009]
%H Dennis S. Bernstein, Omran Kouba, <a href="https://arxiv.org/abs/1901.10703">Counting Colorful Necklaces and Bracelets in Three Colors</a>, arXiv:1901.10703 [math.CO], 2019.
%H Dennis S. Bernstein, Omran Kouba, <a href="https://doi.org/10.1007/s00010-019-00645-w">Counting colorful necklaces and bracelets in three colors</a>, Aequat. Math. (2019) 93: 1183.
%H T. J. McLarnan, <a href="http://dx.doi.org/10.1524/zkri.1981.155.3-4.269">The numbers of polytypes in close-packings and related structures</a>, Zeitschrift für Kristallographie. Volume 155, Issue 3-4, Pages 269-291, ISSN (Online) 0044-2968, ISSN (Print) 1433-7266, DOI: 10.1524/zkri.1981.155.3-4.269, August 2010.
%H J.-F. Michon, P. Ravache, <a href="https://dx.doi.org/10.1016/j.ffa.2010.01.004">On different families of invariant irreducible polynomials over F_2</a>, Finite fields & Applications 16 (2010) 163-174.
%F (see PARI code)
%t L[n_, k_] := DivisorSum[GCD[n, k], MoebiusMu[#]*Binomial[n/#, k/#] &];
%t A165920[n_] := Sum[If[(n + k) ~Mod~ 3 == 1, L[n, k], 0], {k, 0, n}]/n;
%t A001037[n_] := If[n == 0, 1, DivisorSum[n, MoebiusMu[#]*2^(n/#) &]/n];
%t A000048[n_] := DivisorSum[n, (# ~Mod~ 2)*(MoebiusMu[#]*2^(n/#)) &]/(2*n);
%t A011957[n_] := Module[{an}, If[n <= 2, Return[n - 1]]; an =A001037[n]/6;
%t If[n ~Mod~ 2 == 0, an += 1/2*A000048[n/2]];
%t If[n ~Mod~ 3 == 0, an += 2/3*A165920[n/3]];
%t Return[an]
%t ];
%t Table[A011957[n], {n, 1, 50}] (* _Jean-François Alcover_, Dec 02 2015, adapted from _Joerg Arndt_'s PARI script *)
%o (PARI)
%o L(n, k)=sumdiv(gcd(n, k), d, moebius(d) * binomial(n/d, k/d) );
%o A165920(n)=sum(k=0, n, if( (n+k)%3==1, L(n, k), 0 ) ) / n;
%o A001037(n)=if(n<1, n==0, sumdiv(n, d, moebius(d)*2^(n/d))/n);
%o A000048(n)=sumdiv(n, d, (d%2)*(moebius(d)*2^(n/d)))/(2*n);
%o A165921(n)=
%o {
%o my(an);
%o if ( n<=2, return(0) );
%o an = A001037(n);
%o if (n%2==0, an -= 3*A000048(n/2) );
%o if (n%3==0, an -= 2*A165920(n/3) );
%o an /= 6;
%o return( an );
%o }
%o A011957(n)=
%o {
%o my(an);
%o an = A165921(n);
%o if (n%2==0, an += A000048(n/2) );
%o if (n%3==0, an += A165920(n/3) );
%o return( an );
%o }
%o /* simplified version (merging the routines for A011957 and A165921 above): */
%o A011957(n)=
%o {
%o my(an);
%o if ( n<=2, return(n-1) );
%o an = A001037(n) / 6;
%o if (n%2==0, an += 1/2 * A000048(n/2) );
%o if (n%3==0, an += 2/3 * A165920(n/3) );
%o return( an );
%o }
%o /* _Joerg Arndt_, Jul 12 2012 */
%Y Cf. A000048 (number of 3-elements orbits).
%Y Cf. A165920 (number of 2-elements orbits).
%Y Cf. A165921 (number of 6-elements orbits).
%K nonn,easy
%O 1,6
%A _N. J. A. Sloane_
%E Incorrect formula removed and terms verified by _Joerg Arndt_, Jul 12 2012