%I #28 Oct 14 2019 01:28:23
%S 1,1,1,1,1,1,1,1,1,2,1,2,4,4,2,1,4,7,4,1,2,4,4,2,1,2,1,1,3,3,1,3,9,12,
%T 9,3,3,12,24,24,12,3,1,9,24,31,24,9,1,3,12,24,24,12,3,3,9,12,9,3,1,3,
%U 3,1
%N Pascal's hexagonal pyramid, read by slices, with each slice read by rows.
%C Each layer is a hexagon of numbers.
%C Every cell has 7 neighbors: itself and the 6 around it.
%C The sum of the values of the neighbors of a cell in one layer is the value of that cell in the next.
%C Layer 0:
%C 1
%C Layer 1:
%C 1 1
%C 1 1 1
%C 1 1
%C Layer 2:
%C 1 2 1
%C 2 4 4 2
%C 1 4 7 4 1
%C 2 4 4 2
%C 1 2 1
%C Layer 3:
%C 1 3 3 1
%C .
%C 3 9 12 9 3
%C .
%C 3 12 24 24 12 3
%C .
%C 1 9 24 31 24 9 1
%C .
%C 3 12 24 24 12 3
%C .
%C 3 9 12 9 3
%C .
%C 1 3 3 1
%C etc.
%H Aresh Pourkavoos, <a href="/A275122/b275122.txt">Table of n, a(n) for n = 1..10648</a>
%H Wikipedia, <a href="https://en.wikipedia.org/wiki/N-flake#Hexaflake">Hexaflake</a>
%F Odd terms in layer x, where x is 1 less than a power of 2, form a hexaflake (conjectured).
%e Layer 0 is a single 1, so a(1) = 1.
%e Layer 1 is a filled hexagon of seven 1's, so a(2) through a(8) = 1.
%e The numbers in the top row of Layer 2, "1 2 1", become terms a(9) through a(11).
%o (Python)
%o import numpy as np
%o # This is used for the terms[] array
%o numLayers = 22
%o # Number of layers that you want to generate
%o # Number of terms = numLayers^3
%o width = numLayers*2
%o # Width and height of the terms[] array
%o neighbors = [[0, 0], [0, 1], [1, 0], [1, 1], [1, 2], [2, 1], [2, 2]]
%o # Neighbors of terms that are added together
%o terms = np.zeros((numLayers, width, width))
%o # Initialize terms[] array with specified dimensions and fill it with zeros
%o terms[0][0][0] = 1
%o # Place a single 1 in layer 0
%o for l in range(1, numLayers):
%o for x in range(width):
%o for y in range(width):
%o for n in neighbors:
%o terms[l][x][y] += terms[l-1][x-n[0]][y-n[1]]
%o # Calculate terms
%o seq = terms.flatten().tolist()
%o # List containing all terms in array
%o while 0 in seq:
%o seq.remove(0)
%o # Remove zeros from array
%o for s in range(len(seq)):
%o seq[s] = int(seq[s])
%o # Turn all terms from floats to integers
%o final = ""
%o for s in range(len(seq)):
%o final += str(s+1)+" "+str(seq[s])+"\n"
%o # Put the terms into a single string in b-file format
%o bfile = open("b275122.txt", "w")
%o bfile.write(final)
%o bfile.close()
%o # Write this string to the b-file
%Y Cf. A046816, A086754.
%K nonn,look
%O 1,10
%A _Aresh Pourkavoos_, Jul 18 2016