WorksMathematics
-ary Legendre pairs
Abstract
We study -ary Legendre pairs and derive arithmetic restrictions on their existence and balance. For an odd prime , we determine the component sums of a -ary Legendre pair and show that, after normalization, each component has fixed symbol composition. As a consequence, every -ary Legendre pair of length yields a Butson Hadamard matrix . For ternary Legendre pairs we combine fixed-content necklaces, integral-PAF symmetries, exact half-frequency restrictions, compression-decompression, and PSD tests. These reductions lead to ternary Legendre pairs for every admissible length . We conjecture that ternary Legendre pairs exist for every admissible length.
Introduction
Let be a finite complex sequence of length periodically continued with period . The periodic autocorrelation function of at lag is
where is the complex conjugate of . Two sequences and of length form a Legendre pair if
Since for , we may extend the range of in (1) to .
A Legendre pair is binary if . A Hadamard matrix is an matrix with elements such that , where is the identity matrix. Binary Legendre pairs of length are pertinent to the construction of Hadamard matrices of order , see for example [1 Theorem 2], [5 Theorem 3] or [8 Theorem 1]. Binary Legendre pairs of length are known for several infinite sets of , if is a prime (Legendre sequences), if is odd and is a prime power (Szekeres), if with , (-sequences), and a set of which is infinite if the twin-prime conjecture is true, if where and are twin primes, (Jacobi sequence or twin-prime sequence). Several ad hoc constructions are also known. The smallest integer for which the question of existence of binary Legendre pairs is still undecided is . See for example [10] and references therein for the results mentioned here.
A Legendre pair is quaternary if , where . The first and the third author [10] introduced quaternary Legendre pairs of length and showed that they are pertinent to the construction of quaternary Hadamard matrices of order and thus of binary Hadamard matrices of order . Since a binary Legendre pair can be considered quaternary we may restrict ourselves to quaternary pairs of even length . Jedwab and Pender [6] showed that there is a quaternary Legendre pair of length if is a prime power and if for an odd prime for which is a prime power. The first author, Koutschan and the third author [9, 10] found the remaining quaternary Legendre pairs of lengths , Lebedev [11] completed the list finding 7 more values and Verma [16] settled . Now and are the smallest undecided cases.
A Legendre pair is -ary if , where is a primitive complex -th root of unity. For a complex matrix , let denote its conjugate transpose. A Butson Hadamard matrix is an -matrix with entries in which satisfies . From [3, 17] we know that if is prime, and , then can exist only for . For further non-existence results see for example [2, 17].
Our main contributions of this paper are the following results.
First, in Section 2 we prove that for prime a -ary Legendre pair of length can only exist if .
Second, in Section 3 we study the connection between Legendre pairs and Butson Hadamard matrices for general -ary Legendre pairs. More precisely, under explicit conditions on the sequence sums of a Legendre pair of length , we construct Butson Hadamard matrices when is odd and when is even. For odd primes , these conditions are automatically satisfied, yielding a Butson Hadamard matrix from every -ary Legendre pair of length . Note that a may not exist even if a -ary Legendre pair of length exists.
Third, Section 4 deals with the case , that is, ternary Legendre pairs. A pair of (generalized) -sequences covers all lengths of the form with . We combine fixed-content necklaces, integral-PAF symmetries, and exact half-frequency restrictions with compression-decompression and PSD tests. In this way we obtain ternary Legendre pairs for every admissible length . The smallest open cases are then and . Note that for and there is no by [17 Theorem 5] up to the possible exceptions and . However, as we proved in Section 3, for all these there is a .
Non-existence, balance and a construction
A non-existence result
In this subsection we derive a necessary condition on the length for the existence of a -ary Legendre pair when is prime.
Theorem 1. For prime , a -ary Legendre pair of length can exist only if .
Proof. For , the assertion is well-known. It follows from , see for example [13 Proposition 6.4.16], and (1). Now we assume that is an odd prime. Let be a -ary Legendre pair of length . For any , we have
where counts the occurrences of in the two autocorrelation sums and two additional 1s. Thus the are nonnegative integers satisfying
Since
we get
As is prime, the cyclotomic polynomial has degree and is irreducible over . Hence are linearly independent over . Therefore and thus , that is,
and the result follows.
Balance
In this subsection we study the sequence sums of the two components of a -ary Legendre pair. We first establish a condition on the balance for general , and then determine the sequence sums and symbol compositions completely when the alphabet size is an odd prime.
Write , and let be a -ary Legendre pair of length . Put
Lemma 2. For any -ary Legendre pair and defined by (3) we have
Proof. For we have
Hence,
and similarly
Therefore
by (1).
Multiplying all entries of either component by the same th root of unity preserves its PAFs. Independent cyclic shifts of the two components also preserve their PAFs. Simultaneously conjugating both components preserves condition (1), as does interchanging the two components. Conjugating only one component need not preserve the Legendre pair condition. Hence, for binary Legendre pairs we may assume . For quaternary Legendre pairs we may assume , for even and for odd , see [10].
Lemma 3. Let be a -ary Legendre pair. Then
Proof. Put . Since we have .
An automorphism of is uniquely defined by with , . If is applied entrywise to and , then for every lag we have
as well as . Hence, is again a -ary Legendre pair.
By Lemma 2 we get . In particular, we have
Put . Note that is an algebraic integer and thus its norm, the product of its conjugates , , , is a rational integer in , that is, and thus . Finally, Lemma 2 gives , and the result follows.
Let be the number of with . Then we call the symbol composition of .
Theorem 4. Let be an odd prime and let be a -ary Legendre pair of length . Then
Consequently, after multiplying and independently by suitable th roots of unity, we may assume
Moreover, writing , after this normalization each component has symbol composition
Proof. We first exclude the possibility that one of the sequence sums vanishes. Obviously, we have
Suppose that and define . Then . Since is prime, is the minimal polynomial of over , of degree $p-1. Hence divides in . Because , we must have for some . Comparing coefficients gives . Since the are integers, , and therefore , contradicting Theorem 1, which gives . Thus . The same argument shows that .
Lemma 3 now implies .
We next determine the multiplicities . For , set
For we have . For , the map
defines an automorphism of , and . We have
Thus
Using the orthogonality relation
we obtain
Consequently, . By Theorem 1, we can write for some positive integer . Then
Obviously, and for is a solution of this system of equations. Among all -tuples of nonnegative integers with fixed sum , the sum of squares is minimized when the entries differ by at most one. Indeed, if , replacing by preserves the total sum and changes the sum of squares by
Thus a solution tuple must have entries differing by at most one, that is, a cyclic shift of . Therefore
The same argument applied to gives for some . Finally, multiply every entry of by and every entry of by and we may assume .
-sequences: is prime and
We recall the following standard construction for the convenience of the reader.
Let be prime, let with , and put . Let be a primitive element of , and let
be the canonical additive character of . Define
In particular, we have . For , we have
Indeed, for , so the map
is a bijection of . The last equality follows from the orthogonality of nontrivial additive characters; see, for example, [12 Chapter 5.1]. Hence
and therefore is a -ary Legendre pair of length . Note that the definition of Legendre pairs includes the case , that is, for .
k-ary Legendre pairs and Butson Hadamard matrices
The circulant matrix defined by is
Clearly, we have
see for example [4 Theorem 3.2.4], and
To border the circulant block matrix, we seek two additional coordinates making the first two rows orthogonal to the lower block rows. The resulting linear equations lead naturally to the following choices of (and in the even case):
It is easy to see that
The following theorem extends the known Hadamard matrix constructions from binary and quaternary Legendre pairs to the -ary setting.
Theorem 5. Let be an integer and let be a -ary Legendre pair of length .
I. Suppose that is odd and , where are defined by (7). Then
is a Butson Hadamard matrix of order .
II. Suppose that is even and , where are defined by (8). Then
is a Butson Hadamard matrix of order .
Proof. We prove Part I. Put , , , and let denote the all-one row vector of length . By assumption, all entries of the displayed matrix are -th roots of unity.
By (4) and (9), each of the first two rows has squared norm
and their inner product is
Since every row of and has sum and , respectively, the inner products of the first row with rows in the two lower block rows are
by (9). For the second row the corresponding inner products are
which follow by taking complex conjugates in (9).
For two different rows in the first lower block row, the first two entries contribute , while (6) gives contribution on the diagonal and off the diagonal from the remaining entries. Thus these rows have squared norm and are mutually orthogonal. The same holds for the second lower block row, since circulant matrices are normal and hence
Finally, for rows belonging to different lower block rows, the contribution from the first two entries is zero, whereas that from the remaining blocks is
::: by (5). Hence all rows are mutually orthogonal and have squared norm , so the displayed matrix is an .
Part II follows in exactly the same way, replacing , , by , , , respectively, and using (10) in place of (9).
Corollary 6. Let be an odd prime and let be a -ary Legendre pair of length . Then there exists a Butson Hadamard matrix .
Proof. By Theorem 4, after multiplying and independently by suitable th roots of unity, we may assume . Then the quantities defined in (7) become
and
Thus both and are th roots of unity, and Theorem 5 (I) applies.
For we may assume , so that . For and even we may assume and , so that and . For every odd prime , Part I applies automatically by Corollary 6.
For odd prime , the construction therefore always yields an . As mentioned in the introduction, in many cases there exists a ternary Legendre pair of length but no .
For general composite , it is not clear whether the conditions on , or , in Theorem 5 are automatically satisfied.
Ternary Legendre pairs
We now specialize to . By Theorem 1, every ternary Legendre pair has length
By Theorem 4, after multiplying the two components independently by suitable third roots of unity, we may assume
Writing , Theorem 4 shows that each normalized component has composition with respect to the symbols . The construction of Section 2.3 gives ternary Legendre pairs of lengths , , that is, .
For compactness, in the explicit examples below we sometimes write a ternary sequence as an exponent sequence , where represents the entry .
Searches using necklaces with fixed content
Our searches produced ternary Legendre pairs of lengths and . We record existence results, without claiming a complete enumeration of pairs or their equivalence classes. Explicit witnesses for lengths 5, 11, and 17 are given in Appendix A. We give details for . After normalization, each component has composition . After a cyclic shift, we may fix the first entry to be 1. Then there are
possible sequences before equivalences are taken into account. An example of a ternary Legendre pair of length 23 is
A direct exact computation gives
The search can be reduced substantially by generating only necklaces with fixed content. A necklace is the lexicographically smallest member of a rotation class; see [14]. Algorithms for necklaces with fixed content are described in [7]. For and content there are only 137,181,330 such necklaces. Thus the balance result of Section 2 is not only structural: it fixes the content used by the necklace generator before any correlation computation is performed.
Integral PAF parameters and reflection symmetry
For searches restricted to integral periodic autocorrelations, one can impose additional exact arithmetic constraints.
Proposition 7. Let be a normalized ternary Legendre pair of length . Suppose that the nonzero PAFs of one, equivalently both, components are integers. Then there are integers , , such that
Moreover,
More precisely, if
then
Proof. Fix a nonzero lag and suppose . Since
the relation implies . Hence , and therefore for a unique . The Legendre pair identity gives . Solving the equations for the three difference counts gives the displayed formulas, and their nonnegativity yields the pointwise bound.
For every complex sequence, we have . Since the PAF values here are integers, they are real, and hence . Finally,
Using and for gives
If is odd, the reflection symmetry immediately gives . Thus an integral-PAF search at odd length needs only half of the PAF coordinates, together with a zero-sum condition.
As an illustration, a ternary Legendre pair of length 29 is
For this pair, exact computation gives
In particular, and . This provides a convenient exact certificate for the integral PAF profile and illustrates the reduction available in this subclass.
Half-frequency restrictions and compressed searches
We next consider even lengths. The discrete Fourier transform and the power spectral density of a sequence are
For a Legendre pair, we have , . Consequently, the usual PSD test discards any candidate component for which at some nonzero frequency.
For a divisor of , the compression of by the factor is the length- sequence , where
When , write
Then
Thus compression to length 2 is exactly the half-frequency test.
The fixed composition from § 2 yields a sharper form of this test. Since an admissible even ternary length has the form , each normalized component has composition . For a component , let and be the numbers of occurrences of in the even and odd positions, respectively, and put
Theorem 8. Let be a normalized ternary Legendre pair of even length . For each component , we have
The integer is positive and odd, and .
Proof. There are equally many even and odd positions, so . The fixed composition gives
Moreover,
Using and , a direct calculation gives
Since is odd, , and the parity conditions show that is odd. Finally,
which yields .
Corollary 9. Under the assumptions of Theorem 8, we have
Moreover, in the prime factorization of each half-frequency PSD, every prime congruent to 2 modulo 3 occurs with even exponent.
Proof. The congruence follows because and are odd. Also
Every prime congruent to 2 modulo 3 occurs with even exponent in an Eisenstein norm; see, for example, [2 Theorem 3.1] or [15]. Multiplication by 3 does not affect this assertion.
The theorem fits directly into the existing compression-decompression search. Indeed, once an admissible pair has been chosen, a vector determines the parity content of a component uniquely:
Equivalently, in terms of the even-position counts,
Thus the exact half-frequency restriction is applied first, the corresponding parity contents are generated next, and only then are decompression and the full PSD test performed. The original search method is therefore retained, but its candidate space is reduced before the expensive stages.
This approach yields ternary Legendre pairs of lengths 14 and 20. An explicit length-14 witness is included in Appendix § 5. For we have and hence . The admissible complementary Eisenstein norms give, up to interchanging the components,
For example, in the case one may take parity contents
for each component. This leaves
candidate sequences for each component before the remaining filters. A search within this candidate class yields the following ternary Legendre pair:
An exact computation verifies for every nonzero lag.
The length-32 search
The exact half-frequency restriction is particularly effective at length 32. Here , so . Since
and is even, the bound gives . A short enumeration yields
Consequently, up to interchanging and , the only possible half-frequency pairs are
Thus every ternary Legendre pair of length 32 must belong to one of these three spectral cases, which can therefore be searched separately. These are necessary conditions; no realization of every spectral case is asserted.
A targeted search in the case yields the following ternary Legendre pair:
The even/odd symbol counts are
so the half-frequency PSDs are indeed 9 and 57, respectively. For , define
Exact computation gives
Hence
for every nonzero lag, proving that the displayed sequences form a ternary Legendre pair of length 32.
The same half-frequency calculation can be used prospectively at larger even lengths. For example, at it gives, up to interchanging the components,
which provides three exact cases for a targeted search. Here the admissible values with are
and the complementary pairs summing to 26 are , and .
Conjecture 10. Ternary Legendre pairs exist for every admissible length .
The preceding examples illustrate the role of the arithmetic restrictions in the search. The balance theorem fixes the symbol composition, the half-frequency result restricts the admissible spectral cases at even lengths, and the integral-PAF symmetry provides an additional reduction when the autocorrelations are integral. Together with fixed-content necklaces, compression and the PSD test, these conditions provide a layered search strategy for larger ternary lengths. The next open cases are 35 and 38. A broader arithmetic and cyclotomic framework for the structure of Legendre pairs, motivated in part by the computational phenomena observed here, will be developed elsewhere.
Explicit small-length certificates
For completeness, we give directly checkable witnesses for the small lengths stated in Section 4 but not displayed there. In the table below, an exponent word denotes the sequence . Each row gives one existence certificate; no total number of solutions or equivalence classes is asserted. The length-11 and length-14 witnesses were independently reconstructed when preparing these certificates and are not a reproduction of the original search logs.
| Exponent word for | Exponent word for | |
| 5 | 12021 | 12021 |
| 11 | 00120211212 | 00021122121 |
| 14 | 00120202121121 | 00112211022201 |
| 17 | 01212201010221210 | 12110220002201121 |
Table 1.
For each listed length, write . Both components have composition . For every nonzero lag , define the combined quotient counts
Direct integer evaluation at every gives
| for every nonzero | |
| 5 | |
| 11 | |
| 14 | |
| 17 |
Table 2.
In each case this is , so
This verifies the Legendre pair condition without floating-point arithmetic. The accompanying file verify_existence.py performs these checks, checks all explicit pairs in the main text, and generates normalized -sequence certificates for lengths 2, 8, and 26 using the construction of Section 2.3. Thus every nontrivial admissible length is covered either by that construction or by an explicit checked pair. The verification establishes existence, not the completeness or original output count of any search.
Acknowledgments
The authors thank the organizers and referees of SETA 2026 for helpful comments and discussions. This work was developed in part during a visit of Huaning Liu to RICAM, Linz, and during a visit to the Hangzhou International Innovation Institute of Beihang University (H3I), Sino-French Laboratory for Mathematics (SFLM), Hangzhou, P. R. China. The second author was supported by National Natural Science Foundation of China under Grant No. 12571008, and the Science and Technology Program of Shaanxi Province of China under Grant No. 2024JC-JCQN-04. The third author was funded in part by the Austrian Science Fund (FWF) (Grant No. 10.55776/PAT4719224).
References
- [1]K. T. Arasu, D. A. Bulutoğlu and J. R. Hollon, Legendre G-array pairs and the theoretical unification of several G-array families, J. Combin. Des., 28 (2020), no. 11, pp. 814–841.arxiv.org/abs/2004.05608
- [2]B. W. Brock, Hermitian congruence and the existence and completion of generalized Hadamard matrices, J. Combin. Theory Ser. A, 49 (1988), no. 2, pp. 233–261.DOI
- [3]A. T. Butson, Generalized Hadamard matrices, Proc. Amer. Math. Soc., 13 (1962), pp. 894–898.DOI
- [4]P. J. Davis, Circulant matrices. Wiley-Intersci. Publ. Pure Appl. Math. John Wiley & Sons, New York-Chichester-Brisbane, 1979.
- [5]R. J. Fletcher, M. Gysin and J. Seberry, Application of the discrete Fourier transform to the search for generalised Legendre pairs and Hadamard matrices, Australas. J. Combin., 23 (2001), pp. 75–86.
- [6]J. Jedwab, T. Pender, Two constructions of quaternary Legendre pairs of even length, Comb. Theory, 5 (2025), no. 2, Paper No. 15, 18 pp.arxiv.org/abs/2408.08472
- [7]S. Karim, J. Sawada, Z. Alamgir, S. M. Husnine, Generating brackets with fixed content, Theoret. Comput. Sci. 475, 2013, pp. 103–112.DOI
- [8]I. S. Kotsireas, Structured Hadamard conjecture. Number theory and related fields. In memory of Alf van der Poorten. Edited by Jonathan M. Borwein, Igor Shparlinski and Wadim Zudilin. pp. 215–227, Springer Proc. Math. Stat., 43, Springer, New York, 2013.DOI
- [9]I. S. Kotsireas, C. Koutschan, A. Winterhof, Quaternary Legendre pairs II, Discrete Math., 348 (2025), no. 9, Paper No. 114501.DOI
- [10]I. S. Kotsireas, A. Winterhof, Quaternary Legendre pairs, in New Advances in Designs, Codes and Cryptography (C. J. Colbourn and J. H. Dinitz, eds.), Fields Institute Communications, vol. 86, Springer, Cham, 2024, pp. 289–304.arxiv.org/abs/2212.10953
- [11]N. Lebedev, Quaternary Legendre pairs of lengths 42, 46, 52, 58, 66, 72, and 80, https://arxiv.org/abs/2609.04589
- [12]R. Lidl, H. Niederreiter, Finite fields. Cambridge University Press, Cambridge, 1997.
- [13]H. Niederreiter, A. Winterhof, Applied number theory. Springer, Cham, 2015.DOI
- [14]J. Sawada, Generating bracelets in constant amortized time, SIAM J. Comput. 31, No 1, 2001 pp. 259–268.DOI
- [15]R. J. Turyn, Character sums and difference sets. Pacific J. Math. 15 (1965), pp. 319–346.DOI
- [16]H. Verma, A quaternary Legendre pair of length 64, https://arxiv.org/abs/2609.25573.
- [17]A. Winterhof, On the non-existence of generalized Hadamard matrices, J. Statist. Plann. Inference, 84 (2000), no. 1-2, pp. 337–342.DOI