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.

Original entry on oeis.org

1, 1, 1, 3, 3, 7, 8, 17, 21, 47, 63, 132, 205, 411, 685, 1353, 2385, 4643, 8496, 16430, 30735, 59343, 112531, 217245, 415628, 803209, 1545463, 2991191, 5778267, 11201883, 21702708, 42141575, 81830748, 159140895, 309590883, 602938098, 1174779397, 2290920127
Offset: 3

Views

Author

Michel Marcus, May 02 2017

Keywords

Crossrefs

Programs

  • Maple
    A286110 := proc(n)
        if type(n,'odd') then
            add(A052307(n,ceil(n/2)+1+3*i),i=0..n/6+1) ;
        else
            add(A052307(n,ceil(n/2)+3*i),i=0..n/6) ;
            %-A052307(n,n/2)/2+A007148(n/2)/2-1
        end if;
    end proc:
    seq(A286110(n),n=3..40) ; # R. J. Mathar, Jul 23 2017
  • 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 *)
  • 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