OFFSET
3,4
LINKS
Marshall Hampton, Constructing and Counting Hexaflexagons, arXiv:1704.07775 [math.CO], 2017.
MAPLE
MATHEMATICA
A007148[n_] := (1/2)*(2^(n - 1) + Total[EulerPhi[2*#]*2^(n/#) & /@ Divisors[n]]/(2*n));
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];
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]];
Table[a[n], {n, 3, 40}] (* Jean-François Alcover, Nov 28 2017, after R. J. Mathar *)
PROG
(Python)
from sympy import binomial as C, totient, divisors, gcd, floor, ceiling
def a007148(n):
if n==1: return 1
return 2**(n - 2) + sum(totient(2*d)*2**(n//d) for d in divisors(n))//(4*n)
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)
def a(n):
if n%2: return sum([a052307(n, ceiling(n/2) + 1 + 3*i) for i in range(n//6 + 2)])
else:
s=sum([a052307(n, ceiling(n/2) + 3*i) for i in range(n//6 + 1)])
return s - a052307(n, n//2)//2 + a007148(n//2)//2 - 1
print([a(n) for n in range(3, 41)]) # Indranil Ghosh, Jul 24 2017, after Maple code
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, May 02 2017
STATUS
approved