cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A286110 Number of distinct hexaflexagons of length n.

This page as a plain text file.
%I A286110 #20 Apr 27 2021 11:23:09
%S A286110 1,1,1,3,3,7,8,17,21,47,63,132,205,411,685,1353,2385,4643,8496,16430,
%T A286110 30735,59343,112531,217245,415628,803209,1545463,2991191,5778267,
%U A286110 11201883,21702708,42141575,81830748,159140895,309590883,602938098,1174779397,2290920127
%N A286110 Number of distinct hexaflexagons of length n.
%H A286110 Marshall Hampton, <a href="https://arxiv.org/abs/1704.07775">Constructing and Counting Hexaflexagons</a>, arXiv:1704.07775 [math.CO], 2017.
%p A286110 A286110 := proc(n)
%p A286110     if type(n,'odd') then
%p A286110         add(A052307(n,ceil(n/2)+1+3*i),i=0..n/6+1) ;
%p A286110     else
%p A286110         add(A052307(n,ceil(n/2)+3*i),i=0..n/6) ;
%p A286110         %-A052307(n,n/2)/2+A007148(n/2)/2-1
%p A286110     end if;
%p A286110 end proc:
%p A286110 seq(A286110(n),n=3..40) ; # _R. J. Mathar_, Jul 23 2017
%t A286110 A007148[n_] := (1/2)*(2^(n - 1) + Total[EulerPhi[2*#]*2^(n/#) & /@ Divisors[n]]/(2*n));
%t A286110 A052307[n_, k_] := Module[{hk = Mod[k, 2], a = 0}, If[k == 0, Return[1]]; Do[a = a + EulerPhi[d]*Binomial[n/d - 1, k/d - 1], {d, Divisors[GCD[k, n]]}]; (a/k + Binomial[Floor[(n - hk)/2], Floor[k/2]])/2];
%t A286110 a[n_] := Module[{s}, If[Mod[n, 2] == 1, Sum[A052307[n, Ceiling[n/2] + 1 + 3*i], {i, 0, Floor[n/6] + 1}], s = Sum[A052307[n, Ceiling[n/2] + 3*i], {i, 0, Floor[n/6] }]; s - A052307[n, n/2]/2 + A007148[n/2]/2 - 1]];
%t A286110 Table[a[n], {n, 3, 40}] (* _Jean-François Alcover_, Nov 28 2017, after _R. J. Mathar_ *)
%o A286110 (Python)
%o A286110 from sympy import binomial as C, totient, divisors, gcd, floor, ceiling
%o A286110 def a007148(n):
%o A286110     if n==1: return 1
%o A286110     return 2**(n - 2) + sum(totient(2*d)*2**(n//d) for d in divisors(n))//(4*n)
%o A286110 def a052307(n, k): return 1 if n==0 else C((n//2) - k%2 * (1 - n%2), (k//2))/2 + sum(totient(d)*C(n//d, k//d) for d in divisors(gcd(n, k)))/(2*n)
%o A286110 def a(n):
%o A286110     if n%2: return sum([a052307(n, ceiling(n/2) + 1 + 3*i) for i in range(n//6 + 2)])
%o A286110     else:
%o A286110         s=sum([a052307(n, ceiling(n/2) + 3*i) for i in range(n//6 + 1)])
%o A286110         return s - a052307(n, n//2)//2 + a007148(n//2)//2 - 1
%o A286110 print([a(n) for n in range(3, 41)]) # _Indranil Ghosh_, Jul 24 2017, after Maple code
%Y A286110 Cf. A007282, A286111.
%K A286110 nonn
%O A286110 3,4
%A A286110 _Michel Marcus_, May 02 2017