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.

A275122 Pascal's hexagonal pyramid, read by slices, with each slice read by rows.

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