login
Array read by downward antidiagonals: A(n,k) is the number of nonequivalent 2-colorings of the cells of an n-dimensional hypercube with edges k cells long under action of symmetry.
2

%I #122 Jun 24 2023 12:40:29

%S 2,2,1,2,2,1,2,3,2,1,2,6,6,2,1,2,10,102,22,2,1,2,20,8548,2852288,402,

%T 2,1,2,36,4211744,384307306807269376,6296489398464125698304,1228158,2,

%U 1

%N Array read by downward antidiagonals: A(n,k) is the number of nonequivalent 2-colorings of the cells of an n-dimensional hypercube with edges k cells long under action of symmetry.

%C A(0,0) = 2 by the convention that 0^0 = 1, in spirit with A003992.

%C A(n,2) = A000616(n), because the Boolean functions' truth tables are n-dimensional edge-length-2 hypercubes, and are considered equivalent under action of input permutation (transposition of dimensions) and applications of NOT to inputs (reflection in dimensions) that compose for the hypercube's symmetry group.

%C A(n,3) is the number of transitions in an isotropic non-totalistic Life-like cellular automaton with an n-dimensional Moore neighborhood.

%C A(n,k) ~ 2^(k^n)/(n!*2^n) for large k where n >= 1, and large n where k >= 2, and converges from above. Proof: When computing it with the Pólya enumeration theorem (for each action, count colorings of cycles under it instead of cells, average result over actions), the asymptotic form describes the number of states contributed by the identity action. Over k, the values contributed by the other actions are at most O(2^(k^n/2)), so the proportion that they contribute may be made arbitrarily small by choosing a large enough n. Over n, there are no more than n!*2^n such non-identity actions, assuming that they are all of order 2 (as an upper bound). Each one may have no more than a hyperplane (2^k^(n-1)) of fixed points, which (if it is of order 2) will multiply its colorings by 2^(k^(n-1)/2). The ratio of the identity term to the others is at least O(2^k^n/(n!*2^n*2^(k^(n-1)/2))), and its base-2 logarithm, by Stirling's approximation, is O(k^n-n*log(n)-n-k^(n-1)/2), so the 2^(k^n) term will dominate.

%C A(1,k) is the only row >= 1 that is linear-recurrent over k (and has a rational generating function), all other nontrivial rows and columns grow faster than any linear-recurrent function.

%C A000120(A(n,k)) is eventually periodic over k if and only if n <= 2.

%H Nathan L. Skirrow, <a href="/A361870/b361870.txt">Table of n, a(n) for n = 0..59</a>

%H Adam P. Goucher, <a href="https://cp4space.files.wordpress.com/2012/09/moda-ch01.pdf">Combinatorics I</a>, Mathematical Olympiad Dark Arts (2005), 8-11.

%H LifeWiki, <a href="https://conwaylife.com/wiki/Isotropic_non-totalistic_rule">Isotropic non-totalistic rule</a>, <a href="https://conwaylife.com/wiki/P%C3%B3lya_enumeration_theorem">Pólya enumeration theorem</a>.

%H Nathan L. Skirrow, <a href="https://gist.github.com/DroneBetter/90318584a0ad6a0f4d1c418d3da132cd">dimensional_INT_enumerator.py</a> (unreduced version of Python program below, that also finds equations for fixed n).

%F Where an expression can be simplified by dividing a power of 2's coefficient by 2 and incrementing its exponent by 1, it is left as-is, so that the 2^ can be changed to c^ for general c-colorings.

%F A(n,2) = A000616(n).

%F A(0,k) = 2.

%F Herein, c(x) denotes the ceiling function.

%F A(1,k) = A005418(k+1) = (2^k + 2^c(k/2))/2.

%F A(2,k) = A054247(k) = (2^k^2 + 2*2^(k*(k+1)/2) + 2*2^(c(k/2)*k) + 2^c(k^2/2) + 2*2^c(k^2/4))/8.

%F A(3,k) = (2^k^3 + 3*2^(c(k/2)*k^2) + 9*2^(c(k^2/2)*k) + 2^c(k^3/2) + 6*2^(k^2*(k+1)/2) + 6*2^(c(k^2/4)*k) + 6*2^c(c(k^2/2)*k/2) + 8*2^(k*(k^2+2)/3) + 8*2^c(k*(k^2+2)/6))/48.

%F A(4,k) = (2^k^4 + 4*2^(c(k/2)*k^3) + 30*2^(c(k^2/2)*k^2) + 16*2^(c(k^3/2)*k) + 2^c(k^4/2) + 12*2^(k^3*(k+1)/2) + 12*2^(c(k^2/4)*k^2) + 48*2^(c(c(k^2/2)*k/2)*k) + 12*2^c((c(k^2/2)*k^2)/2) + 32*2^(k^2*(k^2+2)/3) + 32*2^(c(k/2)*k*(k^2+2)/3) + 32*2^(c((k*(k^2-1)/3+k)/2)*k) + 32*2^c((k^2*(k^2+2)/3)/2) + 12*2^(k^2*(k^2+1)/2) + 12*2^c(k^4/4) + 48*2^(k*(k^3+k+2)/4) + 48*2^c(k^4/8))/384.

%e n\k|0, 1, 2, 3, 4, 5, 6, 7, ...

%e ---+------------------------------------------------------------------------------

%e 0 |2, 2, 2, 2, 2, 2, 2, 2, ...

%e 1 |1, 2, 3, 6, 10, 20, 36, ...

%e 2 |1, 2, 6, 102, 8548, 4211744, ...

%e 3 |1, 2, 22, 2852288, 384307306807269376, ...

%e 4 |1, 2, 402, 6296489398464125698304, ...

%e 5 |1, 2, 1228158, ...

%e 6 |1, 2, ...

%e 7 |1, ...

%e ...

%o (Python)

%o from functools import reduce

%o from itertools import accumulate

%o from math import isqrt,lcm,factorial as fact

%o tap=lambda f,*i:tuple(map(f,*i))

%o redumulate=lambda f,l,i=None: accumulate(l,f,initial=i)

%o expumulate=lambda f,l: lambda i: accumulate(range(l),lambda x,i: f(x),initial=i)

%o factorise=lambda m: tuple(filter(lambda n: not m%n,range(1,m//2+1)))+(m,)

%o def cycleLengths(dims,size):

%o convert=(lambda m,i,a: (lambda d,n,i: ('('*bool(i)+str(size)+'+~(')*n+a+("//"+str(size**d))*bool(d)+('%'+str(size))*(d<dims-1)+')'*n+(')'*n+'*'+str(size**i))*bool(i))(*m[i],i))

%o boardCells=size**dims

%o matrindex=(lambda p: sum((e-sum(e>d for d,m in p[:i]))*fact(len(p)+~i)*2**dims+2**i*n for i,(e,n) in enumerate(p)))

%o matrices=sorted((tuple((j,n>>i&1) for i,j in enumerate((lambda t: tuple(reduce(lambda e,n: e+(e>=n),t[i-1::-1],e)%dims for i,e in enumerate(t)))(tuple(a[0]%(dims-i) for i,a in enumerate(redumulate(lambda m,i: divmod(m[0],i),range(dims,1,-1),(m,0))))))) for m in range(fact(dims)) for n in range(2**dims)),key=matrindex) if dims else []

%o exps=tap(lambda m: tap(matrindex,expumulate(lambda i: tap(lambda j: (lambda k,l: (k,l^j[1]))(*i[j[0]]),m),lcm(4,fact(dims)))(matrices[0])),matrices)

%o lambdas=tap(lambda m: eval("lambda s: ["+','.join('s['+str(eval('+'.join(map(lambda i: convert(m,i,str(j)),range(dims)))))+']' for j in range(boardCells))+']'),matrices)

%o test=list(range(1,boardCells+1))

%o factors=tap(lambda e: factorise(e[1:].index(0)+1),exps)

%o subperiods=tuple(tuple(sum(map(int.__eq__,test,lambdas[exps[i][a]](test))) for a in f) for i,f in enumerate(factors))

%o return((lambda t: tap(lambda t: reduce(lambda r,t: r+((t[0],t[1]-sum(i[1] for i in r if not t[0]%i[0])),),t,()),t))(tap(lambda a,b: tuple(zip(a,b)),factors,subperiods)))

%o specific=(lambda cycles: int(bool(cycles) and sum(2**sum(i[1]//i[0] for i in c) for c in cycles)//len(cycles)))

%o line=lambda k: (1,2)[k] if k<2 else 1<<k-1|1<<(k-1>>1)

%o A054247=lambda n: (1,2,6)[n] if n<3 else 1<<n**2-3|2**(n+3>>1)+3**(~n&1)<<(n**2-5>>1)|1<<(n**2-5>>2)

%o cube=lambda k: (2**k**3+3*2**((k+1>>1)*k**2)+9*2**((k**2+1>>1)*k)+2**(k**3+1>>1)+6*2**(k**2*(k+1)>>1)+6*2**((k**2+3)//4*k)+6*2**((k**2+1>>1)*k+1>>1)+8*2**(k*(k**2+2)//3)+8*2**(k*(k**2+2)//3+1>>1))//48

%o tesseract=lambda k: (2**k**4+4*2**((k+1>>1)*k**3)+30*2**((k**2+1>>1)*k**2)+16*2**((k**3+1>>1)*k)+2**(k**4+1>>1)+12*2**(k**3*(k+1)>>1)+12*2**((k**2+3>>2)*k**2)+48*2**(((k**2+1>>1)*k+1>>1)*k)+12*2**((k**2+1>>1)*k**2+1>>1)+32*2**(k**2*(k**2+2)//3)+32*2**((k+1>>1)*k*(k**2+2)//3)+32*2**((k*(k**2-1)//3+k+1>>1)*k)+32*2**(k**2*(k**2+2)//3+1>>1)+12*2**(k**2*(k**2+1)>>1)+12*2**(k**4+3>>2)+48*2**(k*(k**3+k+2)>>2)+48*2**(k**4+7>>3))//384

%o nonequivalents=lambda n,k: (lambda k: 2,line,A054247,cube,tesseract)[n](k) if n<5 else 2**k if k<2 else specific(cycleLengths(n,k))

%o A002262=(lambda n: (lambda s: (lambda o: (o,s-o))(n-s*(s+1)//2))(isqrt((n<<3)+1)-1>>1))

%o print(tuple(map(lambda n: nonequivalents(*A002262(n)),range(28)))) # _Nathan L. Skirrow_, May 29 2023

%Y Cf. A000616, A005418, A054247, A003992.

%K tabl,nonn

%O 0,1

%A _Nathan L. Skirrow_, May 28 2023