On maximal partial Latin hypercubes

A lower bound is presented for the minimal number of ﬁlled cells in a maximal partial Latin hypercube of dimension d and order n . The result generalises and extends previous results for d = 2 (Latin squares) and d = 3 (Latin cubes). Explicit constructions show that this bound is near-optimal for large n > d . For d > n , a connection with Hamming codes shows that this lower bound gives a related upper bound for the same quantity. The results can be interpreted in terms of independent dominating sets in certain graphs, and in terms of codes that have covering radius 1 and minimum distance at least 2


Introduction
As the title indicates, the focus in this paper is on Latin hypercubes.However, the topic can be viewed in terms of design theory, graph theory, and coding theory.Previous results appear in several guises and these are reviewed in Sect. 2. We start with some basic definitions.
A Latin square of order n, denoted by LS(n), is a (2-dimensional) n×n array L = [L(i, j)], with entries from an n-element set N , such that each element of N occurs once in each row and once in each column of L. The rows and columns of L are indexed by an n-element set, which we will always take to be the same as the entry set N .Unless we say otherwise, we will take N = Z n = {0, 1, 2, . . ., n − 1}.
A Latin hypercube is a generalisation of a Latin square to higher dimensions.To explain the definition, consider a d-dimensional array H = [H (i 1 , i 2 , . . ., i d )], with each coordinate indexed by an n-element set N .A line in this array is a 1-dimensional array formed from H by holding all but one coordinate fixed and allowing the remaining coordinate to vary through the elements of N .Thus a line in H generalises the notion of a row or a column in a square array of dimension 2. If it is the j th coordinate that is variable, then we will say that the line is in the j direction.The set of all lines in the j direction will be denoted by L j .Clearly there will be exactly n d−1 lines in each of the d possible directions, and so dn d−1 lines altogether.Given any cell C in the array there will be d lines through that cell, and we will denote the set of such lines by L(C).
Having the notion of a line, we can define a Latin hypercube of dimension d and order n, denoted by LH(d, n), to be a d-dimensional array H = [H (i 1 , i 2 , . . ., i d )], with each coordinate indexed by an n-element set N , and entries from the same set N , such that each element of N occurs once in each line of H .As with Latin squares, we will often take N = Z n .A Latin square LS(n) is a particular case of a Latin hypercube LH(d, n) corresponding to dimension d = 2.An example of an LH(d, n) with coordinates indexed by, and entries from, Z n is given by taking the entry in cell (x 1 , x 2 , . . ., x d ) to be d i=1 x i , with addition in Z n .An alternative view of an LH(d, n), which may be easier to visualise, is as a type of group divisible design, where the groups are the n-element sets representing the d coordinates and the entry set itself.So if H is an LH(d, n) then H consists of d + 1 disjoint sets (the groups), where each group is an n-element set, each block of the design has precisely one entry from each group, and each d-tuple from distinct groups lies in precisely one block.
Figure 1 shows a Latin hypercube of dimension 3 and order 4 represented as 4 levels of rows and columns.The reader should visualise the 4 levels being placed on top of one another.
The same Latin hypercube can be viewed as a design, where the groups are the rows, the columns, the levels and the entries.If the rows are designated as i r , the columns as i c , the levels as i , and the entries as i e , each for i = 0, 1, 2, 3, then the blocks in this case are formed as (w r , x c , y l , z e ) where w, x, y, z ∈ Z 4 , and w = x + y + z in Z 4 .For example, in the 0th row, 1st column, 2nd level, the entry is 3 as highlighted in the table.
A partial Latin square of order n, denoted PLS(n), is defined in the same manner as a Latin square of order n except that some of the cells may be empty, in other words, each element of the entry set occurs at most once in each row and at most once in each column.Similarly, a partial Latin hypercube of dimension d and order n, denoted PLH(d, n) is defined in the same manner LH(d, n) except that some of the cells may be empty, in other words, each element of the entry set occurs at most once in each line.A maximal PLH(d, n) is a PLH(d, n) that cannot be extended to another PLH(d, n) by inserting any element of the entry set N into any empty cell.We denote a maximal PLH(d, n) as an MPLH(d, n).This is analogous to a maximal PLS(n), which is a partial Latin square of order n that cannot be extended to another PLS(n) by inserting any entry into any empty cell.A maximal PLS(n) is denoted MPLS(n); it is of course the same thing as an MPLH(2, n).We will denote by f (d, n) the minimal cardinality of an MPLH(d, n), i.e. f (d, n) = min(F : there exists an MPLH(d, n) with precisely F filled cells).
In the next section we review what is already known about maximum partial Latin hypercubes.

Previous results
Our first comment is that it is difficult to recognise what is already known because the problem can be reformulated in so many different forms.We start by reviewing results that explicitly refer to Latin squares (d = 2) and Latin cubes (d = 3) of variable order n.Theorem 2.1 (Horak and Rosa [4]) If L is a partial Latin square of order n (i.e. a PLS(n)) with less than n 2 /2 entries, then it cannot be maximal.Hence f (2, n) ≥ n 2 /2 .
It will help our subsequent discussion to give a proof of this result, essentially that given in [6].In Sect.3, this proof is adapted and extended to deal with the case of higher dimensional hypercubes.
Proof Let F denote the number of filled cells in the partial Latin square L of order n.We assume that F < n 2 /2 and denote by E the number of empty cells, so that E = n 2 − F > n 2 /2.The set of all empty cells will be denoted by E. We can assume that the rows and columns of L are indexed by Z n .Define e 1 (i) to be the number of empty cells in row i, and e 2 ( j) to be the number of empty cells in column j.Then n−1 i=0 e 1 (i) = n−1 j=0 e 2 ( j) = E.If an empty cell (i, j) has less than n filled cells in the union of its row and column then there exists x in the entry set which does not appear in row i or in column j.The number of filled cells in the union of row i and column j is at most (n − e 1 (i))+ (n − e 2 ( j)).Consequently if there is an empty cell (i, j) with e 1 (i) + e 2 ( j) − n > 0, then L may be extended to a PLS(n) L with F + 1 filled cells by inserting an appropriate entry into cell (i, j).
To prove that there is such an empty cell, consider the sum Here the summation is over all empty cells (i, j).Each e 1 (i) will appear in the summation precisely e 1 (i) times, and each e 2 ( j) will appear precisely e 2 ( j) times.Consequently By Cauchy's inequality, Hence S ≥ E( 2E n − n) > 0. Since S > 0, at least one term in the summation must be strictly positive, i.e. there exists an empty cell (i, j) with e 1 (i) + e 2 ( j) − n > 0. The result follows.
For each positive integer n there is an MPLS(n) with the number of filled cells equal to n 2 /2 .As examples, in Fig. 2 we show squares of orders n = 6 and n = 7.It is easy to see how these generalise.So Horak and Rosa [4] also proved the following result about the spectrum of MPLS(n)s, in other words the values of F for which it is possible to construct an MPLS(n) having exactly F filled cells.Theorem 2.2 (Horak and Rosa [4]) Let S n be defined as And suppose that the integer F / ∈ S n , n 2 2 ≤ F ≤ n 2 , and F = n 2 − 1.Then there exists an MPLS(n) having precisely F filled cells.
They went on to conjecture that the values of F covered by Theorem 2.2 form the spectrum of MPLS(n).They eliminated most of the values of F not covered by this Theorem, leaving undetermined the following cases: It is also shown that the bound can be improved slightly by the addition of an O(n 2 ) term.The same paper goes on to construct MPLC(n) with n 3 /3 filled cells when n is divisible by 3, and with n 3 /3 + O(n 2 ) filled cells when n is not divisible by 3.  6) and MPLS (7) As regards the spectrum of values of F (the number of filled cells) for which a MPLC(n) exists the following results are also established in [2].

Theorem 2.4 There exists an MPLC(n) having precisely F filled cells if 1. n ≥ 10 is even and n
Open questions remain about the spectrum below approximately F = n 3 /2.The results of [4] and [2] deal with fixed dimensions (d = 2 and d = 3 respectively) and variable order n.In [5] and in [1] the authors (respectively Jha, and Arumugam and Kala) obtain results covering fixed order n = 2 and variable dimension d.These results are obtained in the context of graph domination numbers.
If G = (V , E) is a finite simple connected graph then S ⊆ V is called a dominating set if every vertex in V \S is adjacent to at least one vertex in S. A dominating set S is called an independent dominating set if no two vertices of S are adjacent.A survey of results on independent dominating sets is given in [3].The minimum cardinality of an independent dominating set of a graph G is called the independent domination number of G and is denoted by i(G).The d-cube Q d is the graph whose vertex set is the set of all d-dimensional boolean vectors, i.e. (Z 2 ) d , two vertices being joined by an edge if and only if they differ in exactly one coordinate.In [5] the following result is established.Theorem 2.5 (Jha [5]) For d a positive integer, the independent domination number of the d-cube satisfies the inequalities In particular, if d + 1 is an integer power of 2, i.e. if d In [1] the authors establish the values of i(Q d ) for d ≤ 6 as shown in Table 1.There is a strong connection between independent dominating sets and maximum partial Latin hypercubes.Let G(d, n) denote the graph with vertex set (Z n ) d+1 in which vertices are joined by an edge if and only if they differ in precisely one coordinate.

Theorem 2.6 An independent dominating set for G(d, n) is equivalent to an MPLH(d, n).
Proof Suppose first that S is an independent dominating set for G(d, n).A PLH(d, n), say H , may be formed by taking each (x 1 , x 2 , . . ., x d , x d+1 ) ∈ S and placing the entry x d+1 in the cell (x 1 , x 2 , . . ., x d ) of H .The independence property of S ensures that no cell receives more than one entry.That H has the Latin property also follows from the independence property: if H had two cells in the same line with the same entry then the corresponding points of S would be adjacent, a contradiction.To see that H is maximal, suppose that is an empty cell of H , so that c k = (x 1 , x 2 , . . ., x d , k) / ∈ S for any k ∈ Z n .Since S is a dominating set, for each k ∈ Z n there exists c k = (x 1 , x 2 , . . ., x d , k) ∈ S, where x i = x i except for one value j where x j = x j .But then cell C k = (x 1 , x 2 , . . ., x d ) is a filled cell of H containing the entry k and it differs in only one coordinate from cell C. So, for any k ∈ Z n , entry k cannot be placed in cell C because this would give two cells in line j with the same entry.We deduce that no further entries can be added to H without violating the Latin condition, and so H is an MPLH(d, n).
Conversely suppose that H is an MPLH(d, n).We may assume that its coordinates and entries are from Z n .Define S ⊆ (Z n ) d+1 to be the set of points: The Latin property of H ensures that no two points from S are adjacent in Since H is maximal, entry k cannot be placed in cell C, and so there is a filled cell of H , C = (x 1 , x 2 , . . ., x d ) containing entry k, where x i = x i except for one value j where Combining this result with those of Theorem 2.5 and Table 1, gives the following results.
In Sect. 3 we will generalise Corollary 2.7 to orders n > 2.
Next we examine connections with coding theory.Results of Quistorff [10] are particularly relevant to Latin hypercubes.For background information on coding theory, see [7].An n-ary code C of length l over Z n is said to have covering radius r if r is the smallest integer such that every vector in Z l n is within Hamming distance r of a codeword of C. It is easy to see that the minimum distance of such a code can be at most 2r + 1.

Theorem 2.8 An MPLH(d, n) is equivalent to a n-ary code C of length d + 1 over Z n with minimum distance at least 2 and covering radius 1.
Proof A code C of length d + 1 over Z n can be viewed as a set S of vertices in the graph G(d, n), and vice-versa.The set S is a dominating set if and only if the corresponding code C has covering radius 1, and it is an independent set (meaning that no two vertices of S are adjacent) if and only if C has minimum distance at least 2. The result then follows from Theorem 2.6.Quistorff [10] uses K n (l, r ) to denote the minimal cardinality of an n-ary code of length l with covering radius at most r .A covering radius of zero implies that the code has every vector as a codeword and hence n l codewords.Apart from the trivial case n = 1, a code with cardinality K n (l, 1) must therefore have covering radius 1.However, such codes may have minimum distance 1. Consequently f (d, n) may not equal K n (d + 1, 1), but we certainly have f (d, n) ≥ K n (d + 1, 1).Rodemich [11] gives the bound K n (d + 1, 1) ≥ n d /d , and this gives the bound For d = 3 this is a better bound than the one given in [2] which we described above.But Theorem 1 of [10] improves on this in certain cases by giving the following lower bound for K n (d + 1, 1).Theorem 2.9 (Quistorff [10]) The bound given in [11] gives f (4, 5) ≥ 157, f (4, 6) ≥ 324, and f (4, 7) ≥ 601.Theorem 2.9 improves these to give: f (4, 5) ≥ 160, f (4, 6) ≥ 330, and f (4, 7) ≥ 606.We give a further improvement covering a wider range of cases in Theorem 3.1 below.Theorem 2 of [10] shows that an n-ary code of length l with minimum distance at least 2, covering radius 1, and having M codewords gives rise to an n-ary code of length l + 1 with minimum distance 2, covering radius 1, and having nM codewords.Recast in the language of Latin hypercubes this can be expressed as follows.
Theorem 2.10 (Quistorff [10]) Suppose that H d is an MPLH(d, n) with exactly F filled cells.Then there exists an MPLH(d + 1, n), H d+1 with exactly n F filled cells.
The basis of the proof is as follows.We may assume that H d is expressed over Z n .Suppose that C = (x 1 , x 2 , . . ., x d ) is any cell of H d .If C is empty, then leave all n cells of the form x d , i) of H d+1 place the entry z + i (addition in Z n ), and do this for each i ∈ Z n .It is easy to check that H d+1 has the desired properties.As a consequence, we have

A lower bound
The bound presented in this section is a generalisation of the result in [4] to Latin hypercubes.It improves the bound in [2], the bound that follows from [11], and the bound that follows from Theorem 1 of [10].It also extends the bound given by [5] to a wider range of cases.

Theorem 3.1 Suppose that H is a partial Latin hypercube of dimension d and order n. To avoid trivialities, assume that d, n ≥ 2 and that
Because r < d it follows that ( 2) In both cases (a) and (b), put l = E n d−1 .Then l ≥ k + 1 except possibly when r > 0 and l = k.
Define e(L) to be the number of empty cells in line L. If we sum e(L) over all lines in a given direction, say the j direction, we get L∈L j e(L) = E.
Let L j (C) denote the line in direction j passing through the cell C. If an empty cell C has less than n filled cells in the union of all d lines through it, then there exists x in the entry set which does not appear in any of these lines.The number of filled cells in a given line L is n − e(L), so the union of all the lines through a cell C has at most d j=1 (n − e(L j (C))) filled cells, where the summation is over all the d lines L j (C) that contain cell C. Consequently, if there is an empty cell C with d j=1 (n − e(L j (C))) < n then H may be extended to a PLH(d, n) H with F + 1 filled cells by inserting an appropriate entry into cell C. Note that the inequality is equivalent to s To prove that there is such an empty cell, consider the sum S of s(C) over all empty cells C. If E denotes the set of all empty cells in H then The aim is to prove that S > 0, thereby showing that at least one of the empty cells can be filled.
For an empty cell C there will be d lines through C. Consider lines in a single fixed direction, say the j direction.There will be one such line, namely L j (C), through each empty cell C and in the summation C∈E e(L j (C)), each term will be counted e(L j (C)) where the summation on the right-hand side is over all n d−1 lines in the j direction.
The minimum possible value of T j = L∈L j (e(L)) 2 subject to L∈L j e(L) = E is obtained by distributing the total value E as evenly as possible amongst the n d−1 lines L ∈ L j .The average value per line is Hence T j will be minimised if e(L) = l for λ lines, and e(L) = l + 1 for μ lines, where λ + μ = n d−1 and lλ + (l + 1)μ = E.These equations for λ and μ give λ

It follows that
We consider four possibilities, namely: , but this can only happen in case (a) when r > 0 and then from inequality ( 1), But E ≥ ln d−1 and so (iv) Finally, if l ≥ k + 2 then inequality (3) gives Again using E ≥ ln d−1 , we obtain In conclusion, S > 0 in all cases under consideration and the result follows.
We remark that for d = 2 (squares) this result coincides with the n 2 /2 result of [4].For d = 3 (cubes) it improves the result of [2], and brings it into line with the MPLC(n)s constructed in that paper that have precisely n 3 /3 filled cells.Some rather tedious arithmetic shows that the bound of Theorem 3.1 is always at least as good as that provided by Theorem 1 of [10] (Theorem 2.9 above).In particular, f (4, 5) ≥ 164, f (4, 6) ≥ 336, and f (4, 7) ≥ 612.Theorem 3.1 also applies to a much wider range of the parameters d and n than Theorem 1 of [10].
When n ≤ d, in the terminology of Theorem 3.1, we have q = 0, r = n and k = n − 1, and the bound reduces to Hence, even when n > d, the bound implies the same inequality, although this inequality is then weaker than the bound.So in all cases we have f (d, n) ≥ n d+1 d(n−1)+n .For n = 2 this coincides with the lower bound of Corollary 2.7 that came from the results of Jha [5].So the bound of Theorem 3.1 extends that of [5].
In the next two sections we examine how close the bound is to optimality.

Constructing MPLH(d, n) for fixed d
The focus in this section is primarily on the case n ≥ d.An examination of the proof of Theorem 3.1 suggests that it is likely that any MPLH(d, n) with precisely n d /d filled cells will have the property that for any empty cell, the entries in the lines through that cell are distinct and cover the entire entry set.Furthermore, if n is divisible by d, each line through an empty cell will (most likely) have n/d entries in such a minimal MPLH.The results below go some way to support this conjecture by producing designs with these properties.
Theorem 4.1 Suppose that d ≥ 2 and that q is a prime or prime power less than or equal to d.Then there exists an MPLH(d, q) with precisely q d−1 filled cells.

Proof
The proof is by direct construction of an MPLH(d, q) denoted by H .All arithmetic is in a finite field F q with q elements; we denote the elements of the field in some fixed order as λ 1 , λ 2 , . . ., λ q .The coordinates of H will be indexed by, and its entries taken from, F q .The filled cells of H are those with coordinates (x 1 , x 2 , . . ., x d ) where d i=1 x i = 0.The remaining cells of H are empty.Clearly there are precisely q d−1 filled cells and only one filled cell in each line.The entry in a filled cell (x 1 , x 2 , . . ., x d ) is e = q i=1 λ i x i .Note that this entry does not depend on x j for the value j such that λ j = 0, and if q < d, this entry does not depend on x q+1 , x q+2 , . . ., x d .
Take an empty cell C = (y 1 , y 2 , . . ., y d ).Then S = d i=1 y i = 0. We show that the d lines through C collectively contain as entries all the elements of F q .Put T = q i=1 λ i y i .Consider any coordinate position j where 1 ≤ j ≤ q.Put x j = y j − S so that the cell D j = (y 1 , y 2 , . . ., y j−1 , x j , y j+1 , . . ., y d ) is the unique filled cell of H that lies on the line through C in the j direction.The entry in cell D j is e j = T + λ j (x j − y j ) = T − λ j S.
If we take two distinct lines through the empty cell C, say in the j and k directions where j = k and 1 ≤ j, k ≤ q, then the entries in these lines are e j = T − λ j S and e k = T − λ k S, so that e j − e k = (λ k − λ j )S = 0. Hence e j = e k .Since there are q such lines through each empty cell C, no new entry may be placed into any such cell C, and so H is an MPLH(d, q).As a simple consequence of Theorem 4.1 we have the following corollary.

Corollary 4.2 Suppose that d is a prime or prime power. Then there exists an MPLH(d, d) with precisely d d−1 filled cells.
Our next result will enable us to meet the bound of Theorem 3.1 in more cases.

Theorem 4.3 Suppose that H is an MPLH(d, n) with exactly F filled cells and that k is a positive integer. Then there exists an MPLH(d, kn), H , with exactly k d F filled cells.
Proof We can assume that k > 1.Take H to be an MPLH(d, n) with entry set Z n and precisely F filled cells.Replace each filled cell of H containing the entry i by a Latin hypercube of dimension d and order k with entry set {ik, ik + 1, . . ., ik + (k − 1)}.Each empty cell of H is replaced by an empty d-dimensional array of order k.In the representation of H as a group divisible design, this means that each point of H is inflated by a factor k, i.e. replaced by k new points, and each block of H is replaced by a Latin hypercube of type LH(d, k).The resulting design H still has d + 1 groups, but these now have cardinality kn and each empty cell has all kn entries in the union of lines through that cell.So H is an MPLH(d, n) having precisely k d F filled cells.A rather messier argument deals with the situation when n is not divisible by d.We may assume that the coordinates of H m are indexed by Z m and that the entries are from the same set.We wish to add r extra possibilities for each of the d coordinates and r extra entries from the set Y = {m, m + 1, . . ., m + r − 1} to extend H m to an MPLH(d, m + r ), H .This is done by adding entries greedily in two stages.
In the first stage, take the existing lines of H m in a single fixed direction, say the first.There are m d−1 such lines.Every empty cell of H m will lie in one of these lines.For each such line, insert new entries from Y into empty cells in that line until no further entries can be inserted without violating the Latin condition (i.e., that no line in any direction has a repeated entry).At most r entries can be placed in each line in the first direction, and so the maximum number of new entries that can be added in this way is rm d−1 .Once this process is complete, none of the original cells of H m that remain empty can have any entry from Z m+r inserted without violating the Latin condition.
In the second stage, note that H will have (m + r ) d cells, so the number of new cells added to H m to form H is (m + r ) d − m d ≤ dr(m + r ) d−1 .Insert entries from Z m+r into these new cells until no further entries can be inserted without violating the Latin condition.At most dr(m + r ) d−1 new entries are made in this process.
The partial Latin hypercube H that results from the two stages cannot be extended by inserting any entry from Z m+r into any empty cell, and so H is an MPLH(d, m +r ).The total number of entries in H is at most the sum of the number of entries in H m plus the number added in stages one and two above.So H has at most Finally in this section we construct MPLH(d, n) designs when d is neither a prime nor a prime power.These designs come close to meeting a lower bound of n d /d filled cells.
By applying Theorem 4.3, the MPLH(d, q) constructed in Theorem 4.1 can be inflated by a factor k to give an MPLH(d, qk) with precisely q d−1 × k d = (qk) d /q filled cells.So when n is a multiple of q we have an MPLH(d, n) with n d /q filled cells.When n is not a multiple of q we may again proceed as in Theorem 4.5 by adding extra possibilities for each of the d coordinates and extra entries to obtain an MPLH(d, n) having, for large n, n d /q + O(n d−1 ) filled cells.This result is stated in the following theorem.MPLH(d, n) that has at most n d /q + O(n d−1 ) filled cells, where q is the largest prime or prime power less than d.

Theorem 4.6 If d is neither a prime nor a prime power then, for large n, there exists an
How close n d /q is to n d /d obviously depends on d.There are many results concerning gaps between primes.As an example, we cite Nagura [8] who proved that for m ≥ 25, there exists a prime p satisfying m ≤ p ≤ 6m/5.As a consequence it follows that for any d that is not a prime or prime power, there is a prime or prime power q satisfying 5d/6 ≤ q ≤ d.So in all cases we have the following corollary of Theorem 4.6.

Corollary 4.7 If d is neither a prime nor a prime power then, for large n, there exists an MPLH(d, n) that has at most 6n
More recent results about gaps between primes improve the factor 6/5, taking it down to arbitrarily close to 1 for larger values of d.

Constructing MPLH(d, n) for fixed n
The focus in this section is on the case d ≥ n.We will show that the bound of Theorem 3.1 can sometimes be achieved, and that it is possible to get close in other cases.Our first theorem would be vacuous if codes with such parameters did not exist.But the parameters are those of Hamming codes Ham(r , n), which exist whenever n is a prime or prime power (see [7]).Proof The parameters of C ensure that C is a perfect code, and so has covering radius 1. Applying Theorem 2.8, C is therefore equivalent to an MPLH(d, n) with n d+1−r filled cells.
However, n r = d(n − 1) + n, so the number of filled cells is n d+1 d(n − 1) + n .
Non-trivial perfect n-ary codes are only known for n a prime or prime power.It is conjectured that none exist when n is not a prime or prime power.Moreover, when n is a prime or prime power, any non-trivial perfect code C must have the parameters of Ham(r , n) for some r ≥ 2, or it is one of the Golay codes G 23 and G 11 .The code G 23 is a binary code with minimum distance 7 and covering radius 3. The code G 11 is a ternary code with minimum distance 5 and covering radius 2. So Theorem 5.1 cannot be applied directly to either of these codes.
When the parameters of an MPLH(d, n) do not correspond to those of a Hamming code, some progress can be made as a result of Theorem 2.10 that shows how to increment the dimension of an existing MPLH.To see how this works consider the code Ham(4, 2) which generates an MPLH(14, 2) having 2 11  It is unlikely that there is a precise general formula for the minimum number filled cells in an MPLH(d, n).But it may be possible to tighten the upper bound for this quantity and to improve the lower bound.

Corollary 4 . 4
Suppose that d is a prime or prime power, and that n is divisible by d.Then there exists an MPLH(d, n) with precisely n d /d filled cells.Proof By Corollary 4.2, there exists an MPLH(d, d) with precisely d d−1 = d d /d filled cells.Put k = n/d and apply Theorem 4.3 to obtain an MPLH(d, n) with precisely k d × (d d /d) = n d /d filled cells.

Theorem 4 . 5
If d is a prime or prime power then, for large n, there exists an MPLH(d, n) that has at most n d /d + O(n d−1 ) filled cells.Proof Suppose that n = dk + r , where 1 ≤ r ≤ d − 1.Take H to be an MPLH(d, d) with precisely d d−1 filled cells.Inflate H by the factor k as described in the proof of Theorem 4.3 to form an MPLH(d, m), say H m , where m = dk.Then H m has precisely m d /d filled cells.

Theorem 5 . 1
Suppose that r , n > 1 are integers and that C is a code over Z n of length (n r − 1)/(n − 1) (= d + 1, say) that has n d+1−r codewords and minimum distance 3. Then C is equivalent to an MPLH(d, n) with precisely n d+1 d(n − 1) + n filled cells (the bound of Theorem 3.1).

Corollary 5 . 2 = n r − 1 n − 1 − 1 for r > 1 .
filled cells.The "'next" Hamming code Ham(5, 2)   generates an MPLH(30, 2) having 2 26 filled cells.By repeated use of Theorem 2.10, we can (for examples) obtain an MPLH(22, 2) that has 2 11+8 = 2 19 filled cells and an MPLH(29, 2) that has 2 11+15 = 2 26 filled cells.These numbers of filled cells correspond to the values of the upper bound given in Corollary 2.7.Indeed, we can generalise that bound as follows.If n is a prime or prime power then, for d ≥ n,n d+1 d(n − 1) + n ≤ f (d, n) ≤ n d+1 n log n ((n−1)d+n) .Proof Theorem 3.1 established the lower bound in all cases.By Theorem 5.1 and the existence of Hamming codes, f (d, n) = n d+1 d(n − 1) + n whenever d has the form d = d(r ) The lowest such value of d is n, which corresponds to r = 2.To establish the result it is necessary to "fill the gap" between d(r ) and d(r + 1) for r ≥ 2. It is easy to see that d(r + 1) − d(r ) = n r , so the gap contains n r − 1 values of d.Now take an arbitrary d * in the gap so that d * = d(r ) + k where 0 < k < n r .Starting with an MPLH(d(r ), n) that has the minimum number of filled cells f (d(r ), n), apply Theorem 2.10 k times to produce an MPLH(d(r ) + k, n) having n k f (d(r ), n) filled cells.This is an MPLH(d * , n) with precisely F filled cells, where F = n k n d(r )+1 d(r )(n − 1) + n

Table 2
Minimum number of filled cells in an MPLH(d, 2) denote the number of filled cells in H . Then if F < n d d + δ, H cannot be maximal.In other words, f (d, n) ≥ n d d + δ .Proof The non-triviality conditions on d and n ensure that k ≥ 1.Let E denote the number of empty cells in H , so that E = n d − F, and assume that F < n d d + δ.Case (a):