Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #14 Jul 15 2023 06:22:48
%S 1,1,2,14,924,852960
%N Number of n X n X n alternating sign hypermatrices.
%C An alternating sign hypermatrix (ASHM) of order n is an n X n X n hypermatrix with entries from {0, 1, -1} such that the nonzero entries of each row, column, and vertical line alternate in sign, beginning and ending with +1.
%C ASHMs are the three-dimensional analog of alternating sign matrices and generalize Latin squares, as the set of n X n X n ASHMs containing no negative entries is in bijection with the set of n X n Latin squares.
%H R. Brualdi and G. Dahl, <a href="https://doi.org/10.1016/j.aam.2017.11.005">Alternating sign matrices and hypermatrices, and a generalization of Latin squares</a>, Advances in Applied Mathematics, 95 (2018), 116 - 151.
%H Cian O'Brien, <a href="https://doi.org/10.1016/j.aam.2020.102097">Alternating sign hypermatrix decompositions of Latin-like squares</a>, Advances in Applied Mathematics, 121 (2020), 102097.
%F Verified using 2 computer searches. The search given counts all sequences of n alternating sign matrices of order n that form an ASHM. The other search uses corner-sum matrices, which are known to be in bijection with alternating sign matrices, by counting all 3-dimensional analogs of corner-sum matrices.
%e For n = 1, the only n X n X n ASHM is [[[1]]].
%e For n = 2, the two n X n X n ASHMs are
%e [[[1,0],
%e [0,1]],
%e [[0,1],
%e [1,0]]]
%e and
%e [[[0,1],
%e [1,0]],
%e [[1,0],
%e [0,1]]].
%o (Sage)
%o # Program written in Sage
%o # Returns True if a given list of n n X n ASMs form an ASHM, returns False otherwise
%o def ASHM(L):
%o n = len(L)
%o # Searches through the vertical line in position (i,j) of the hypermatrix for each i and j
%o for i in range(n):
%o for j in range(n):
%o # Since the first nonzero entry in each line of an ASHM is +1, the alternating condition is checked
%o # as if the previous nonzero entry was -1
%o last = -1
%o for k in range(n):
%o # In each position of the current vertical line, if the sign of the current entry is the opposite
%o # of the previous, then the previous sign is updated
%o if L[k][i,j]*last == -1:
%o last *= -1
%o # Otherwise False is returned unless the current entry is 0
%o elif L[k][i,j] != 0:
%o return False
%o # If the most recent nonzero entry is not +1 by the time all entries have been checked, False is returned
%o if last != 1:
%o return False
%o # If False has not been returned, return True
%o return True
%o # Generates all combinations of one element from each list in L
%o def combos(L, current = [[]]):
%o # If there are no elements left which have not been combined, then return the combinations already made
%o if len(L) == 0:
%o return current
%o # Otherwise, each element of the next list in L is appended to the current list of combinations made
%o output = []
%o for K in current:
%o for a in L[0]:
%o output.append(K + [a])
%o return combos(L[1:], output)
%o # Counts all ASHMs of order n
%o def count_ASHMs(n):
%o # All ASMs of order n are imported as matrices
%o asms = []
%o for A in AlternatingSignMatrices(n):
%o asms.append(A.to_matrix())
%o # Initially, zero ASHMs have been counted
%o count = 0
%o # Every possible combination of n n X n ASMs is checked
%o for i in combos([[k for k in range(len(asms))] for m in range(n)]):
%o # If the current list of n n X n ASMs forms an ASHM, then it is counted
%o count += int(ASHM([asms[i[k]] for k in range(n)]))
%o # The final count is returned
%o return count
%o # Note: I ran a more efficient version of this program in Python to obtain the answer for n=5, and even then it took 6 hours.
%o print(count_ASHMs(0))
%o print(count_ASHMs(1))
%o print(count_ASHMs(2))
%o print(count_ASHMs(3))
%o print(count_ASHMs(4))
%o print(count_ASHMs(5))
%o # _Cian O'Brien_, May 31 2023
%Y 3-dimensional analog of A005130, generalization of A002860.
%K nonn,hard,more
%O 0,3
%A Samuel Zbarsky (sa_zbarsky(AT)yahoo.com), Sep 07 2008
%E a(4) corrected and a(5) added, and definition updated by _Cian O'Brien_, May 31 2023