Two-valued number pyramids

Number pyramids are common in elementary school mathematics. Trying to express the value of the top block in terms of the values at the base leads to the binomial coefficients. It also seems natural to ask for the maximal number of odd numbers in a number pyramid of a given size. The answer is easy to state, but the proof is nontrivial: A k\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$k$$\end{document} step number pyramid can have at most k(k+1)+13\documentclass[12pt]{minimal} \usepackage{amsmath} \usepackage{wasysym} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{amsbsy} \usepackage{mathrsfs} \usepackage{upgreek} \setlength{\oddsidemargin}{-69pt} \begin{document}$$\left\lfloor\frac{k(k+1)+1}{3}\right\rfloor$$\end{document} odd numbers, which equals two thirds of the number of blocks rounded to the nearest integer. All maximal and almost maximal solutions are given explicitly. To this end, we rephrase the question in terms of colored tilings. In the outlook we present relations to other—mostly geometric—subjects and problems.


Introduction
Number pyramids are schemes like in Fig. 1, which are common in elementary school mathematics [1,5]. Each block of the bottom row is filled with an arbitrary natural number; each of the remaining blocks is filled with the sum of the numbers of the two blocks, that it rests upon. The mathematical content of number pyramids is roughly equivalent to the binomial coefficients, cf. Sect. 6.2. But by their plausible way of construction, they join algebraic, geometric, and combinatorial properties at an elementary level, which makes them a well-suited subject for learning and exploring mathematics. We will make use of the links between the different aspects of number pyramids in this article. Now, the fact "odd + odd = even" forces a certain number of even numbers to be present in each number pyramid with more than one block. This leads to the question How many odd numbers can appear in a number pyramid of a given size?
I'd like to thank Ulrich Kortenkamp for his encouraging comments on an earlier version of this article. Furthermore, I'd like to thank the Mathematisches Forschungsinstitut Oberwolfach for supporting the open access publication of this article.

Geometric formulation
To make use of symmetry, we will rephrase this question in more geometric terms.

Tilings
In this article, n always stands for a nonnegative integer. A tiling as in Fig. 2 made of regular hexagons where the bottom row consists of n C 1 tiles will be called a tiling of size n. In Fig. 2 we have n D 5. The set of tiles will be called n . For each n we choose one such n once and for all. The tiled area has roughly the shape of an upright equilateral triangle, more precisely: the convex hull-drawn in orange in the right part of Fig. 2-of the centers of the tiles is an equilateral triangle, one of whose vertices points upwards. Taking the distance of the centers of two neighboring tiles to be 1, the edges of the aforementioned triangle are of length n, which may justify the diction "tiling of size n".
With the exception of Sect. 6 and the closing remark of Sect. 2.2, the n are the only tilings considered. Therefore no specific name like pyramid tiling of size n was chosen. n is operated on by the symmetry group of the equilateral triangle, which consists of 6 elements: the identity, the clockwise and counter clockwise rotations by 120 degrees, and the three reflections at the center verticals of the triangle.
The downward direction will be called the first direction. The direction rotated counter clockwise by 120 degrees will be called the second direction (upwards to the right). The direction rotated by another 120 degrees will be called the third direction (upwards to the left), cf. Fig. 2.
The set of all tiles at one height will be called a row. The image of a row after clockwise or counter clockwise rotation by 120 degrees will be called a row as well.

Colorings
The set of blue points in Fig. 3 will be called ƒ n . A map f W n ! f0,1g will be called an admissible coloring of size n-or a coloring of size n for short-iff for each blue point the number of tiles with value 1 meeting at that point is even. Interpreting the value 0 as white, the value 1 as black, this means, that each blue point must be a vertex of exactly 0 or exactly 2 black tiles. The term "coloring" only refers to the colors black and white; the blue and the colors green and red to appear later purely serve for readability. Now the question reads: For a given n how many black tiles can a coloring of size n have at most? K Fig. 3 Definition of the term coloring with the aid of the point set ƒ n A weak result can be obtained by a direct local to global argument: At each blue point look at the hexagon occupying one third of each of the adjacent original hexagons. Then by the local conditions at most two thirds of the area of the new hexagons is black. The remains are colored rhombi along the boundary of the original tiling of size n. But as n grows, the number of tiles of the new tiling grows like n 2 , while the number of rhombi along the boundary grows like n. Thus for large n this upper bound for the total ratio of black tiles to all tiles of a coloring of size n approaches 2 3 . We will not carry out this proof in detail, because theorems 1 and 2 yield stronger results and require different techniques.

Elementary properties and examples
We start with some simple considerations and examples.
Each choice of colors for the bottom row of a tiling can be extended uniquely to a coloring of that tiling: By virtue of the conditions in the blue points, one can work upwards choosing the colors row by row.
Coloring the bottom row from left to right by periodically repeating 1, 1, 0 determines a coloring to be called a n . Analogously, let b n be the coloring obtained by periodically repeating 0, 1, 1 in the bottom row.
The two series will be called the standard colorings. For n D 9 and n D 10 they are shown in Fig. 4 together with the coloring c 3 , which we will need as a special case. The white coloring of size n will be called w n . It is shown in Fig. 4 for n D 5.

Symmetries
As the conditions in the blue points are invariant under the symmetry group of the equilateral triangle, that group also operates on the set of colorings of n , i.e., a rotated or reflected coloring is again a coloring.
Two colorings f 1 and f 2 will be called equivalent, symbolically: f 1 f 2 , iff f 2 arises from f 1 by one of the 6 symmetry operations. Looking at the periodic patterns on the three boundary rows of a n and b n , respectively, one finds, that a n and b n are equivalent, iff n is not divisible by 3.

Extensions and restrictions
Adding i rows to the tiling n in the first direction, then j rows in the second direction, and lastly k rows in the third direction yields an embedding of n into nCi Cj Ck to be called i:j:k. Now, let i, j , and k be chosen arbitrarily, and let m denote the sum i C j C k. Then, by removing the additional rows, a coloring f of size n C m yields a coloring of size n, called the restriction of f to n . Conversely, any coloring of n can be extended to a coloring of nCm by choosing one color for exactly one tile of each additional row-the colors of the remaining tiles being uniquely determined then. Hence with respect to a fixed embedding i:j:k, each coloring of size n possesses exactly 2 m different extensions to colorings of size n C m. As there are exactly two colorings of size 0, there are exactly 2 nC1 colorings of size n.
In terms of mineralogy one can think of the initial coloring of size n as a seed crystal. Very small seed crystals appear in the proof of theorem 2, namely the white colorings w 0 and w 1 . The row by row extension may be thought of as chemical deposition and the process of extending a coloring to a larger one resembles crystal growth.

Sinks
Two tiles of a tiling are called adjacent or neighboring, if they "meet"-or equivalently, if they have a common edge. A nonempty subset S of the set of white tiles of a coloring will be called a sink, iff 1. any two tiles of S can be joined by a sequence of adjacent tiles in S and 2. every white tile adjacent to a tile in S belongs to S already.
The sinks of a coloring are just the connected components of the set of the white tiles.
Lemma 1 Each sink is a white coloring of some size, i. e., each sink has the shape of an "upright equilateral triangle".
Proof Let S be a sink of a coloring of size n. As S is nonempty, it contains a white tile, i. e., a white coloring of size 0.
If S contains a white coloring w of size k touched by an additional white tile, then all tiles touching w from the same direction are white as well. Hence S contains a white coloring of size k C1, namely the extension of w by one row in the direction considered.
If S contains a white coloring of size k not touched by any additional white tile, then S equals that white coloring of size k.
Starting with the white coloring of size 0 contained in S, the second case occurs after at most n steps.
If all sinks of a coloring are of size 0, we say, that the white tiles lie separately in that coloring.

Density
Let f W E ! R be a real-valued function on a finite set. The sum of the values of f will be called the integral of f . In the sequel the domain of the function will be n or n . Now, let f be again a coloring of size n. The integral I.f / is the number of black tiles of f . As black tiles require some white tiles nearby, we will rewrite I.f / with the aid of a density function: Let n be the set of the green points in Fig. 5. A point of n will be called a face point, if it touches 3 tiles, an edge point, if it touches only 2 tiles, and a vertex point, if it touches only 1 tile. The idea behind that is the natural stratification of the convex hull of n , understood as a polygon. Definition 1 With the notation of Fig. 6, define the density of the coloring f to be at an edge point q, and to be The density f is a real-valued function on the set n .

Lemma 2
For each function f W n ! R, a fortiori for each coloring, holds.
Proof The weights of each tile with respect to the individual points of n sum up to 1. For a coloring, the left-hand side of Eq. (1) is obviously integral, while the righthand side possesses an easy to prove upper bound: Let f be a coloring of size n and let p be in n . For the density of f at p only a few tiles near p are relevant. Up to symmetry Fig. 7 shows all possible colorings of the relevant tiles. From this figure one easily reads off, that the density of a coloring is bounded by 6 9 at a face point, by 4 9 at an edge point, and by 3 9 at a vertex point. The function n W n ! R, that takes these values at the respective types of points, will be called the ideal density function. The integral I. n / will be called the ideal total density-to be consistent, one should say mass instead of total density.

Lemma 3
The estimate I.f / Ä I. n / holds for each coloring f of size n.
K Proof I.f / equals I. f / according to lemma 1. As f is pointwise smaller than or equal to n , this holds for the integrals, too: I. f / Ä I. n /.

Maximal density
By the Gauss summation formula the tiling of size n consists of N n WD .n C 1/.n C 2/ 2 tiles.

Theorem 1
The maximal number of black tiles of a coloring of size n is which equals 2 3 N n C 1 3 , if n is divisible by 3, and 2 3 N n otherwise. For each n the standard coloring a n realizes that maximum.
Proof Let f be a coloring of size n. The set n contains .n 1/n 2 face points, 3n edge points and 3 vertex points. By lemma 3 we have .n 1/n 2 6 9 C 3n 4 9 C 3 3 9 D n 2 C 3n C 3 3 If n is not divisible by 3, then 2 3 N n is integral. As I.f / is integral, too, we have the slightly stronger estimate I.f / Ä 2 3 N n in this case. The standard coloring a n realizes the ideal density in each point of n , except-if n is not divisible by 3-in one of the three vertex points. Therefore if n is divisible by 3 and I.a n / D 2 3 N n if n is not divisible by 3 holds for the coloring a n .

Deficit and malus
The amount the density of a coloring lacks compared to the maximal density will be called deficit: Let f be a coloring of size n. Define the deficit function of f by Define the malus-or the persistent deficit-N d f of f at p as the minimum of the deficits d e f .p/, where the minimum is taken over all colorings e f that extend f .
Define the total malus of f as N D f WD I. N d f /. Fig. 7 shows all possibilities for density, deficit and malus at a face point, an edge point, and a vertex point p. To obtain all possible cases, it suffices to look at the at most 6 tiles next to p, not at the whole colorings f or e f . As usual, the cases are reduced modulo symmetry.

Almost maximal solutions
Theorem 2 states the maximal number of black tiles for tilings of a given size. Moreover, for each size a coloring that realizes the maximum is given. This answers the original question completely and constructively. We'd now like to determine all colorings that reach or almost reach the maximum.
Let's call a coloring f of size n an almost maximal solution, iff its total deficit is less than or equal to 1. This is a uniform way to say: f is maximal in the sense of theorem 1 or n is divisible by 3 and I.f / is 1 below the maximum. Technically, the local deficit grows in steps of ninths anyway.
Theorem 2 Let f be an almost maximal solution of size n. Then the following holds: 1. f a n or 2. n is divisible by 3 and f b n or 3. n D 3 and f c 3 .
Proof Assume that f is a coloring of size n, whose total malus is less than or equal to 1, which is neither equivalent to a n nor to b n nor to c 3 . We will infer a contradiction from this assumption. Let s be the maximal sink size of f , i.e., f contains a sink of size s, but no larger one.
First case: The coloring f has no white tiles at all. Then f is the black tiling of size 0, hence equivalent to a 0 .
Second case: Let s D 0. Choose a sink of size 0, and perceive f as a successive extension of this sink. Rotate and reflect f in a way, that there are at least as many rows added in the first direction as there are added in the second direction and at K Fig. 8 Crystallization with maximal sink size 0 least as many rows added in the second direction as there are added in the third direction. We will call the resulting coloring again f .
When extending f successively, add all rows in the first direction at first, all rows in the second direction next, and all rows in the third direction at last. This procedure is shown in Fig. 8, wherein the following notation is used: Directions: The "large tiles" named i:j:k contain only colorings, where i rows have been added to the crystal nucleus in the first direction, j rows have been added in the second direction, and k rows have been added in the third direction. As explained above, we have i j k.
Arrows: The single and double arrows roughly head into the direction of the addition of rows. A pair of single arrows indicates the two possible extensions by one line into that direction. A double arrow indicates, that there is a unique extension by one row, that adheres to the admitted sink size and the admitted maximal malus.
Non-extendability due to a "seesaw": A red bow indicates the non-extendability in that direction, because both extensions by one row would contain too large a sink.
The coloring in 1.0.0 is the standard coloring a 1 , the two extendable colorings in 2.0.0 and 1.1.0 respectively are equivalent to the standard coloring a 2 , and better yet: one easily finds, that any-even any iterated-extension of a 2 with maximal sink size 0 is again a standard coloring. This is the desired contradiction in the case s D 0.
Third case: Let s D 1. We choose a sink of size 1 for our crystal nucleus, and just like in the preceding case, we can assume i j k for symmetry reasons. Fig. 9 shows all possible crystallizations of that kind. Developing the notation of Fig. 8 further, we use two more symbols: Malus: Computing the malus of colorings of maximal sink size 1 is easy: A black triangle of size 1 pointing downwards causes a malus of 3 9 . (Larger black triangles can't appear in any coloring as a matter of principle.) A sink of size 1 also causes a malus of 3 9 , because the three edge points of the sink have a malus of 1 9 each. Thus tree times the total malus equals the number of the sinks of size 1 plus the number of the black triangles of size 1 heading downwards. The red points are meant to simplify that counting. As the total malus is limited by 1, at most 3 red points are allowed.
K Non-extendability due to a "bar": A red bar indicates three adjacent black tiles in a boundary row of a coloring of total malus 1. An extension of the coloring in this direction would lead to another black triangle of size 1 heading downwards, which would in turn raise the malus beyond the admitted maximum.
A generalization of the "seesaw": In a coloring of total malus 1 a red bow may also indicate the alternative between too large a sink or one more sink of size 1, both of which would raise the malus beyond the limit.
Each coloring depicted in Fig. 9 either has a total deficit greater than 1 or is equivalent to the exceptional coloring c 3 . This is the desired contradiction in the 3rd case.
Last case: Let s 2. As even a single sink of size 2 causes a malus greater than 1, this case is contradictory, too.
So, for each n the standard coloring a n is-up to symmetry-the only coloring that reaches the maximum of theorem 1. Its deficit is 0, if n is divisible by 3, and 1 3 otherwise.
The standard coloring b n has deficit 1, if n is divisible by 3. If n is not divisible by 3, it is equivalent to a n .
Apart from that, there is-up to symmetry-only one almost maximal solution, namely c 3 . Its deficit equals 1.

Vector space structure
Colorings with values in a ring R can be added to each other and scaled by ring elements in a way, that they form an R-module. Our set f0,1g of values should not be viewed as a part of Z, but as the two-element field F 2 turning the set of colorings of size n into a vector space over F 2 of dimension n C 1. However, I don't see a way to take advantage of the vector space structure for the purpose of this article.
Over F 2 the condition at a point p 2 ƒ n defining a coloring can be written more elegantly as f .x 1 / C f .x 2 / C f .x 3 / D 0, where the x i denote the three tiles with common vertex p. The symmetry properties of the coloring can be read off directly from these equations.  The number of black tiles should not be expressed as I.f /-to this end, one would have to embed F 2 into Z as a set, not as a ring-but as #f 1 .f1g/, because we are actually dealing with cardinalities of preimages.

Binomial coefficients
If f W n ! R is a coloring with values in a unitary ring R, holds, x 0 , x 1 , ..., x n denoting the tiles of the bottom row from left to right and y denoting the tile of the top row. The corresponding formula holds for any restriction of f . If n is a power of 2 and R D F 2 , according to Lucas's theorem [2,6,7] all but the first and the last summand vanish, so we have This "action at a distance" allows for augmented embeddings of colorings as exemplified in Fig. 10.
The multiplicities, that a number appears with in the tiles above it, are best seen when tiling the upper half plane instead of a triangle and putting a single 1 into the bottom row: Taking values in Z, one gets Pascal's triangle, cf. Fig. 11, taking values in F 2 , one gets, again according to Lucas's theorem, a marvelously selfsimilar pattern, cf. Fig. 12, suitable for instance for an iterative construction of the Sierpinski triangle.

Colorings of other surfaces
Tiling the whole plane, one gets rid of the boundary problem, the definition of density simplifies, and one can easily show, that only the periodic extension of the pattern a n has the maximal density of 2 3 . On the other hand, when dealing with noncompact surfaces one has to confine oneself to local quantities, because the global counterparts will usually be infinite.
Doubly periodic colorings of the plane can be interpreted as colorings of a torus. Thus at the price of periodicity, one obtains both an empty boundary and global quantities.

Coordinate representation
Of course, n , ƒ n , and n can be defined rigorously instead of by reference to exemplifying graphics. To this end consider the three-dimensional real vector space R 3 and choose a fixed n. The level surface E n WD s 1 .fng/ of the linear form is a euclidian plane. The set G n WD E n \ Z 3 of points with integer coordinates is a triangular lattice (albeit without a preferred origin) in E n .
The Voronoi polygons of that lattice tile the plane E n by regular hexagons. The intersection of E n and the nonnegative octant .R 0 / 3 is an equilateral triangle. Define the tiling of size n to be the set of those Voronoi polygons, whose centers lie in the intersection of G n and the nonnegative octant. That is to say: A is the center of a tile of the tiling of size n, if and only if x, y and z are nonnegative integers, whose sum is n.
Defined that way, the symmetry group of the equilateral triangle operates on the tiling of size n by permutation of the coordinates.

Differentiation and integration
The transition from one horizontal row of a coloring to the adjacent superior row is a discrete differentiation: The upper row contains the sequence of differences of the values of the initial row, for over F 2 addition and subtraction are the same. Conversely, the transition from a horizontal row of a coloring to the adjacent inferior row is a discrete integration. The free choice of color of one tile corresponds to the free choice of one value of an indefinite integral.
For number pyramids with values in more general rings, adjacent rows in the two other directions are still connected by discrete differentiation and integration as explained in [3].

Convolution
The assignment of the density function f to each function f on n like in definition 1 may be written as an integral transform: Due to the finiteness of the domain the integral is merely a sum. The integral kernel g.p; x/ D '.t.p/; p x/ has almost the form of a convolution. However, the function ' not only depends on the difference p x, but also on the type t.p/ of the point p, where the type is to indicate whether the point is a face point, an edge point or a vertex point, and-in case of the latter two-to which edge or vertex it belongs. In principle, the mapping rule of ' is given by Fig. 6, extended by 0 to the whole lattice containing n n , if necessary.
If we also extend f to the whole lattice containing n by the above mapping rule, the correction term of ' on the boundary of n keeps f from "dissolving", i. e., the support of f stays within n , and yet no part of f "gets lost", i. e. Z n φ.t.p/; p-x/ dp D 1 holds for all x 2 n .

Elementary sets
To close with a problem: Let's call a subset B of the tiling n an elementary set, iff each arbitrary choice of colors on B can be uniquely extended to a coloring of n . The simplest example of an elementary set is the bottom row of n : Given arbitrary values on the bottom row, there is obviously one and only one coloring extending these choices. For dimensional reasons the number of elements of an elementary set must be n C 1. But this condition is not sufficient. So, can elementary sets be characterized in a way that is easy to check?
Speaking more formally: The inclusion map i B W B ! n induces the restriction morphism res B W U n ! F .B; F 2 / of vector spaces over F 2 , where U n denotes the vector space of colorings of size n and F .B; F 2 / denotes the vector space of F 2valued functions on B. For which sets B is this morphism an isomorphism? Images All images were created by the author using TikZ.
Funding Open Access funding enabled and organized by Projekt DEAL.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4. 0/.