Designs, Codes and Cryptography https://doi.org/10.1007/s10623-023-01325-2 On the equivalence of Zps -linear generalized Hadamard codes Dipak K. Bhunia1 · Cristina Fernández-Córdoba1 · Carlos Vela2 · Mercè Villanueva1 Received: 13 November 2022 / Revised: 13 October 2023 / Accepted: 16 October 2023 © The Author(s) 2023 Abstract Linear codes of length n over Z ps , p prime, called Z ps -additive codes, can be seen as subgroups of Znps . A Z ps -linear generalized Hadamard (GH) code is a GH code over Z p which is the image of a Z ps -additive code under a generalized Gray map. It is known that the dimension of the kernel allows to classify these codes partially and to establish some lower and upper bounds on the number of such codes. Indeed, in this paper, for p ≥ 3 prime, we establish that some Z ps -linear GH codes of length p t having the same dimension of the kernel are equivalent to each other, once t is fixed. This allows us to improve the known upper bounds. Moreover, up to t = 10 if p = 3 or t = 8 if p = 5, this new upper bound coincides with a known lower bound based on the rank and dimension of the kernel. Keywords Generalized Hadamard code · Gray map · Z ps -linear code · Rank · Kernel · Classification Mathematics Subject Classification 94B25 · 94B60 Communicated by V. D. Tonchev. The material in this paper was presented in part at the international conference Algebraic and Combinatorial Methods for Coding and Cryptography (ALCOCRYPT), 20–24 February 2023, Marseille, France. This work has been partially supported by the Spanish Ministerio de Ciencia e Innovación under Grants PID2019-104664GB-I00, PID2022-137924NB-I00, and RED2022-134306-T (AEI / 10.13039/501100011033); by the Catalan AGAUR scholarship 2020 FI SDUR 00475 and Grant 2021 SGR 00643; and by the Portuguese Foundation for Science and Technology (FCT-Fundação para a Ciência e a Tecnologia), through CIDMA - Center for Research and Development in Mathematics and Applications, within project UIDB/04106/2020. B Dipak K. Bhunia dipak.bhunia@uab.cat Extended author information available on the last page of the article 123 D. K. Bhunia et al. 1 Introduction Let Z ps be the ring of integers modulo p s with p prime and s ≥ 1. Let Znps be the set of n-tuples over Z ps . In this paper, the elements of Znps will also be called vectors. The order of a vector u over Z ps , denoted by o(u), is the smallest positive integer m such that mu = (0, . . . , 0). A code over Z p of length n is a nonempty subset of Znp , and it is called linear if it is a subspace of Znp . Similarly, a nonempty subset of Znps is a Z ps -additive code if it is a subgroup of Znps . When p = 2 and s = 1, a Z ps -additive code is a binary linear code and, when p = 2 and s = 2, it is a quaternary linear code or a linear code over Z4 . The usual Gray map φ from Z4 to Z22 , that is, the map such that φ(0) = (0, 0), φ(1) = (0, 1), φ(2) = (1, 1) and φ(3) = (1, 0) [14], has been generalized to different maps, which p s−1 go from Z ps to Z p [4, 8, 9, 13, 17, 19, 25]. In this paper, we consider the following generalization of Carlet’s Gray map [13]: φs (u) = (u s−1 , . . . , u s−1 ) + (u 0 , . . . , u s−2 )Ys−1 , (1) s−1 i where u ∈ Z ps , [u 0 , u 1 , . . . , u s−1 ] p is the p-ary expansion of u, that is, u = i=0 p ui (u i ∈ Z p ), and Ys−1 is a (s − 1) × p s−1 matrix whose columns are all the different elements of Zs−1 p . We assume, without loss of generality, that the columns of Ys−1 are ordered in ascending order, by considering them as the p-ary expansions of the elements of the ring np s−1 Z ps−1 . Then, we define Φs : Znps → Z p as the component-wise Gray map φs . Let C be a Z ps -additive code of length n. The Gray map image of C , C = Φs (C ), is called a Z ps -linear code. Note that the length of C is p s−1 n. As a subgroup of Znps , C is isomorphic to an abelian structure Ztp1s × Ztp2s−1 × · · · × Ztps , and we say that C , or equivalently C = Φs (C ), is of type (n; t1 , . . . , ts ). Note that |C | = p st1 p (s−1)t2 · · · p ts . A Z ps -additive code C can also be seen as a Z ps -submodule of Znps . As a Z ps -module, C is free only if it is of type (n; t1 , 0, . . . , 0). For linear codes over rings which are not free, there does not exist a basis. However, for any linear code over Z ps , there does exist a generator matrix having minimum number of rows, that is, with t1 + · · · + ts rows. Note that the rows of this generator matrix contain ti codewords of order p s−i+1 , for i ∈ {1, . . . , s}. Let Sn be the symmetric group of permutations on the set {1, . . . , n}. Two Z ps -additive codes of length n, C1 and C2 , are permutation equivalent if there is a permutation of coordi- nates π ∈ Sn such that C2 = {π(c) : c ∈ C1 }. Two codes of length n over Z p , C1 and C2 , are equivalent if there is a vector a ∈ Znp and a permutation of coordinates π ∈ Sn such that C2 = {a + π(c) : c ∈ C1 }. Let C be a code over Z p . The rank of C is the dimension of its linear span, C, and it is denoted by rank(C). The kernel of C is K(C) = {x ∈ Znp : x + C = C} [2, 20], and its dimension is denoted by ker(C). If the all-zero vector belongs to C, then K(C) is a linear subcode of C. Note also that if C is linear, then K (C) = C = C. The values of rank(C) and ker(C) can be used to distinguish between nonequivalent codes over Z p , since equivalent ones have the same rank and dimension of the kernel. A generalized Hadamard (G H ) matrix H ( p, λ) = (h i j ) of order n = pλ over Z p is a pλ × pλ matrix with entries from Z p with the property that for every i, j, 1 ≤ i < j ≤ pλ, each of the multisets {h is − h js : 1 ≤ s ≤ pλ} contains every element of Z p exactly λ times [15]. An ordinary Hadamard matrix of order 4μ corresponds to a G H matrix H (2, λ) over Z2 , where λ = 2μ [1]. Two G H matrices H1 and H2 of order n are said to be equivalent if one can be obtained from the other by a permutation of the rows and columns and adding the same element of Z p to all the coordinates in a row or in a column. We can always change 123 On the equivalence of Zps -linear generalized Hadamard codes the first row and column of a G H matrix into zeros and we obtain an equivalent G H matrix which is called normalized. Let H be a normalized GH matrix. We also denote by H the set of rows of H . The code C H = α∈Z p (H + α1), where H + α1 = {h + α1 : h ∈ H } and 1 denotes the all-one vector, is called generalized Hadamard (G H ) code [10]. Note that C H is generally a nonlinear code over Z p . If C is a Z ps -additive code such that Φs (C ) is a GH code, then we say that C is a Z ps -additive GH code and Φs (C ) is a Z ps -linear GH code. Note that a GH code over Z p of length N has pN codewords and minimum distance N ( p − 1)/ p. GH matrices over Z p are also known as Butson Hadamard matrices, introduced in [5], since p is prime. They can also be seen as square difference matrices. Difference matrices, introduced in [6], are matrices whose elements belong to a finite group, such that in the difference of two distinct row vectors each element of the group occurs equally often. In [23], three different constructions of difference matrices (the direct method, the iterative procedure and the Kronecker product construction) were considered. They also studied the codes induced by these matrices, and showed that these codes are optimal. In [27], binary Hadamard codes obtained by using a general concatenation construction given in [28] are studied. Unlike the Z ps -linear GH codes, the codes from [27] come from codes over Zq which are not necessarily linear, after applying not necessarily the same generalized Gray map in each coordinate. Let At,s, p and At, p be the number of nonequivalent Z ps -linear GH codes of length p t , when both t and s are fixed, and when just t is fixed, respectively. The Z4 -linear Hadamard codes of length 2t can be classified by using either the rank or the dimension of the kernel [16, 21]. There are exactly At,2,2 =  t−1 2 nonequivalent such codes for all t ≥ 2. In [11], it is proved that the dimension of the kernel for Z2s -linear Hadamard codes provides a complete classification giving At,s,2 for all values of t and s, except for t ≥ 8 and 3 ≤ s ≤ t − 5. This partial classification is improved in [3], by giving At,s,2 also for any 3 ≤ t ≤ 11 and s ≥ 2. In [12], for s ≥ 2, it is established that some Z2s -linear Hadamard codes of length 2t are equivalent, once only t is fixed, and this fact improved the known upper bounds for At,2 . Moreover, the authors showed that, up to t = 11, this new upper bound coincides with the known lower bound (based on the rank and dimension of the kernel). For s ≥ 2 and p ≥ 3 prime, an iterative construction and the dimension of the kernel for Z ps -linear GH codes of length p t are established in [3], and it is also proved that this invariant only provides a complete classification for certain values of t and s. Lower and upper bounds are also established for At,s, p and At, p . From [3], we can observe that there are nonlinear codes having the same rank and dimension of the kernel for different values of s, once the length p t is fixed, at least for all 4 ≤ t ≤ 10 if p = 3 and 4 ≤ t ≤ 8 if p = 5. In this paper, we show that, for all t ≥ 4 and p ≥ 3 prime, some Z ps -linear GH codes of length p t having different values of s are permutation equivalent to each other, once t is fixed. Moreover, for all t ≤ 10 if p = 3 and t ≤ 8 if p = 5, the codes that are permutation equivalent are, in fact, those having the same pair of invariants, rank and dimension of the kernel. For example, in Table 3, the codes in bold type have the same rank and dimension of the kernel and are, in fact, permutation equivalent. These results allow us to obtain a more accurate classification of the Z ps -linear GH codes, than the one given in [3]. Z ps -additive codes have also been studied in [24, 26] as two-weight codes over Z ps by considering the homogeneous weight. Recently, rank and pairs of rank and dimension of the kernel for Z p Z p2 -linear codes have been studied in [18]. The paper is organized as follows. In Sect. 2, we recall the recursive construction of Z ps -linear GH codes, the known partial classification, and some bounds on the number of nonequivalent such codes, presented in [3]. In Sect. 3, we prove some equivalence relations among the Z ps -linear GH codes of the same length p t . Later, in Sect. 4, we improve the 123 D. K. Bhunia et al. classification given in [3] by refining the known bounds. Finally, in Sect. 5, we give some conclusions and further research on this topic. 2 Preliminaries and known partial classification In this section, we provide some known results for Z ps -linear GH codes of length p t with t ≥ 3 and p prime. These results were presented mainly in [3, 11, 12] and are related to the recursive construction, partial classification, and bounds on the number of such nonequivalent codes. Let Ti = { j · pi−1 : j ∈ {0, 1, . . . , p s−i+1 − 1}} for all i ∈ {1, . . . , s}. Note that T1 = {0, . . . , p s −1}. Let t1 , t2 ,…,ts be nonnegative integers with t1 ≥ 1. Consider the matrix Atp1 ,...,ts whose columns are exactly all the vectors of the form zT , z ∈ {1} × T1t1 −1 × T2t2 × · · · × Tsts . Let 0, 1, 2, . . . , ps − 1 be the vectors having the same element 0, 1, 2, . . . , p s − 1 from Z ps in all its coordinates, respectively. Any matrix Atp1 ,...,ts can also be obtained by applying the following recursive construction. We start with A1,0,...,0 p = (1). Then, if we have a matrix A = Atp1 ,...,ts , for any i ∈ {1, . . . , s}, we may construct the matrix   A A ··· A Ai = . (2) pi−1 · 0 pi−1 · 1 · · · pi−1 · (ps−i+1 − 1) t ,...,ts Finally, permuting the rows of Ai , we obtain a matrix A p1 , where t j = t j for j = i and t ,...,t ti = ti + 1. Note that any permutation of columns of Ai gives also a matrix A p1 s . Along this paper, we consider that the matrices Atp1 ,...,ts are constructed recursively starting from A1,0,...,0 p in the following way. First, we add t1 − 1 rows of order p s , up to obtain Atp1 ,0,...,0 ; then t2 rows of order p s−1 up to generate Atp1 ,t2 ,...,0 ; and so on, until we add ts rows of order p to achieve Atp1 ,...,ts . See [3] for examples. Let Htp1 ,...,ts be the Z ps -additive code of type (n; t1 , . . . , ts ) generated by the matrix Atp1 ,...,ts , where t1 , . . . , ts are nonnegative integers with t1 ≥ 1 and p prime. Let n = p t−s+1 ,  s  t1 ,...,ts where t = i=1 (s − i + 1) · ti − 1. The code H p has length n, and the corresponding t1 ,...,ts t1 ,...,ts Z ps -linear code H p = Φs (H p ) is a GH code of length p t [3]. In order to classify the Z ps -linear GH codes of length p t , we can focus on t ≥ 5 and 2 ≤ s ≤ t − 2 when p = 2 [11], and on t ≥ 4 and 2 ≤ s ≤ t − 1 when p ≥ 3 prime [3]. Moreover, as shown in the following three theorems, for any t ≥ 5 and 2 ≤ s ≤ t − 2, there are two Z2s -linear Hadamard codes of length 2t which are linear; and for any t ≥ 4, 2 ≤ s ≤ t − 1 and p ≥ 3 prime, there is a unique Z ps -linear GH code of length p t which is linear. Theorem 1 [16] The codes H21,t2 and H22,t2 , with t2 ≥ 0, are the only Z4 -linear Hadamard codes which are linear over Z2 . Theorem 2 [11] The codes H21,0,...,0,ts and H21,0,...,0,1,ts , with s > 2 and ts ≥ 0, are the only Z2s -linear Hadamard codes which are linear over Z2 . Theorem 3 [3] The Z ps -linear GH codes H p1,0,...,0,ts , with p ≥ 3 prime, s ≥ 2 and ts ≥ 0, are the only Z ps -linear GH codes which are linear over Z p . 123 On the equivalence of Zps -linear generalized Hadamard codes Table 1 All linear Z2s -linear GH codes of length 2t and dimension t + 1 t =4 t =5 t =6 t =7 (t1 , . . . , ts ) (t1 , . . . , ts ) (t1 , . . . , ts ) (t1 , . . . , ts ) Z4 (1, 3) (1, 4) (1, 5) (1, 6) (2, 1) (2, 2) (2, 3) (2, 4) Z23 (1, 0, 2) (1, 0, 3) (1, 0, 4) (1, 0, 5) (1, 1, 0) (1, 1, 1) (1, 1, 2) (1, 1, 3) Z24 (1, 0, 0, 1) (1, 0, 0, 2) (1, 0, 0, 3) (1, 0, 0, 4) (1, 0, 1, 0) (1, 0, 1, 1) (1, 0, 1, 2) Z25 (1, 0, 0, 0, 0) (1, 0, 0, 0, 1) (1, 0, 0, 0, 2) (1, 0, 0, 0, 3) (1, 0, 0, 1, 0) (1, 0, 0, 1, 1) Z26 (1, 0, 0, 0, 0, 0) (1, 0, 0, 0, 0, 1) (1, 0, 0, 0, 0, 2) (1, 0, 0, 0, 1, 0) Z27 (1, 0, 0, 0, 0, 0, 0) (1, 0, 0, 0, 0, 0, 1) Z28 (1, 0, 0, 0, 0, 0, 0, 0) Table 2 All linear Z ps -linear GH codes of length p t with p ≥ 3 prime and dimension t + 1 t =4 t =5 t =6 t =7 (t1 , . . . , ts ) (t1 , . . . , ts ) (t1 , . . . , ts ) (t1 , . . . , ts ) Z p2 (1, 3) (1, 4) (1, 5) (1, 6) Z p3 (1, 0, 2) (1, 0, 3) (1, 0, 4) (1, 0, 5) Z p4 (1, 0, 0, 1) (1, 0, 0, 2) (1, 0, 0, 3) (1, 0, 0, 4) Z p5 (1, 0, 0, 0, 0) (1, 0, 0, 0, 1) (1, 0, 0, 0, 2) (1, 0, 0, 0, 3) Z p6 (1, 0, 0, 0, 0, 0) (1, 0, 0, 0, 0, 1) (1, 0, 0, 0, 0, 2) Z p7 (1, 0, 0, 0, 0, 0, 0) (1, 0, 0, 0, 0, 0, 1) Z p8 (1, 0, 0, 0, 0, 0, 0, 0) Tables 1 and 2 show the values of t1 , . . . , ts for all linear Z ps -linear GH codes H pt1 ,...,ts of length p t with 4 ≤ t ≤ 7 and p prime, given by Theorems 1, 2, and 3. Note that the case p = 2 is different from the case p ≥ 3 prime. Tables 3 and 4, for 4 ≤ t ≤ 10 and 2 ≤ s ≤ t − 1, show all possible values of (t1 , . . . , ts ) for which there exists a nonlinear Z ps -linear GH code H pt1 ,...,ts of length p t with p ≥ 3 prime. For each one of them, taking p = 3, the values (r , k) are shown, where r is the rank (computed by using the computer algebra system Magma [7, 22]) and k is the dimension of the kernel (determined in [3]). Note that the values of k are the same for any p ≥ 3 prime, but the values of r are only given for p = 3. Also note that if two codes have different values (r , k), then they are not equivalent. On the one hand, taking only the values of the dimension of the kernel given in these tables, it is easy to see that this invariant does not always give a classification. For example, in Table 4, for t = 8, there are two Z33 -linear GH codes with the same dimension of the kernel, k = 5, that are nonequivalent since they have different rank, r = 22 and r = 16. On the other hand, considering only the values of the rank given in these tables, it is easy to note that the rank does give a classification, since all the codes have different values of the rank, once t and s are fixed, at least when 4 ≤ t ≤ 10 and p = 3. 123 D. K. Bhunia et al. Table 3 Rank and kernel for all nonlinear Z3s -linear GH codes of length 3t t =4 t =5 t =6 t =7 (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) Z9 (2, 1) (6,3) (2, 2) (7,4) (3, 1) (12,4) (3, 2) (13,5) (3, 0) (11,3) (2, 3) (8,5) (4, 0) (21,4) (2, 4) (9,6) Z33 (1, 1, 0) (6,3) (2, 0, 0) (13,2) (1, 2, 0) (12,4) (1, 2, 1) (13,5) (1, 1, 1) (7,4) (2, 0, 1) (14,3) (2, 0, 2) (15,4) (1, 1, 2) (8,5) (2, 1, 0) (25,3) (1, 1, 3) (9,6) Z34 (1, 0, 1, 0) (7,4) (1, 1, 0, 0) (14,3) (1, 0, 2, 0) (13,5) (1, 0, 1, 1) (8,5) (1, 1, 0, 1) (15,4) (2, 0, 0, 0) (34,2) (1, 0, 1, 2) (9,6) Z35 (1, 0, 0, 1, 0) (8,5) (1, 0, 1, 0, 0) (15,4) (1, 0, 0, 1, 1) (9,6) Z36 (1, 0, 0, 0, 1, 0) (9,6) Similarly, Table 5 shows that this also happens for p = 5 when 4 ≤ t ≤ 8; and Tables 1 and 3 given in [11] show that it is also true for p = 2 when 4 ≤ t ≤ 11. Let X t,s, p be the number of nonnegative  integer solutions (t1 , . . . , ts ) ∈ Ns of the equa- s tion t = i=1 (s − i + 1) · ti − 1 with t1 ≥ 1. This gives the number of sequences t1 ,...,ts (t1 , . . . , ts ) such that H p is a Z ps -linear GH codes of length p t . Let At,s, p be the num- ber of nonequivalent Z p -linear GH codes of length p t and a fixed s ≥ 2. Then, for any t ≥ 5 s and 2 ≤ s ≤ t − 1, we have that At,s,2 ≤ X t,s,2 − 1, since there are exactly two codes which are linear [11]. For p ≥ 3 prime, t ≥ 4 and 2 ≤ s ≤ t − 1, we have that At,s, p ≤ X t,s, p , since there is exactly one code which is linear. Moreover, these bounds are tight for t ≤ 11 if p = 2 [11], t ≤ 10 if p = 3 [3], and t ≤ 8 if p = 5 from Table 5. It is still an open problem to know whether this bound is always tight or not. A partial classification for the Z ps -linear GH codes of length p t is given for p = 2 in [11], and for p ≥ 3 prime in [3]. Specifically, lower and upper bounds on the number of nonequivalent such codes, once only t is fixed, are established. Let At, p be the number of nonequivalent Z ps -linear GH codes of length p t . We first consider the case p = 2. Theorem 4 [11] For t ≥ 3,  t−2 At,2 ≤ 1 + (X t,s,2 − 2) (3) s=2 and  t−2 At,2 ≤ 1 + (At,s,2 − 1). (4) s=2 The upper bounds (3) and (4) on At,2 are improved in [12], where it is proved that, for a fixed t, there are Z2s -linear Hadamard codes of length 2t that are equivalent. It is also 123 On the equivalence of Zps -linear generalized Hadamard codes Table 4 Rank and kernel for all nonlinear Z3s -linear GH codes of length 3t t =8 t =9 t = 10 (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) Z9 (3, 3) (14,6) (3, 4) (15,7) (3, 5) (16,8) (4, 1) (22,5) (4, 2) (23,6) (4, 3) (24,7) (2, 5) (10,7) (5, 0) (36,5) (5, 1) (37,6) (2, 6) (11,8) (2, 7) (12,9) Z33 (1, 2, 2) (14,6) (1, 2, 3) (15,7) (1, 2, 4) (16,8) (1, 3, 0) (22,5) (1, 3, 1) (23,6) (1, 3, 2) (24,7) (2, 0, 3) (16,5) (2, 0, 4) (17,6) (1, 4, 0) (37,6) (2, 1, 1) (26,4) (2, 1, 2) (27,5) (2, 0, 5) (18,7) (3, 0, 0) (48,3) (2, 2, 0) (43,4) (2, 1, 3) (28,6) (1, 1, 4) (10,7) (3, 0, 1) (49,4) (2, 2, 1) (44,5) (1, 1, 5) (11,8) (3, 0, 2) (50,5) (3, 1, 0) (82,4) (1, 1, 6) (12,9) Z34 (1, 0, 2, 1) (14,6) (1, 0, 2, 2) (15,7) (1, 0, 2, 3) (16,8) (1, 1, 0, 2) (16,5) (1, 0, 3, 0) (23,6) (1, 0, 3, 1) (24,7) (1, 1, 1, 0) (26,4) (1, 2, 0, 0) (49,4) (1, 1, 0, 4) (18,7) (2, 0, 0, 1) (35,3) (1, 1, 0, 3) (17,6) (1, 1, 1, 2) (28,6) (1, 0, 1, 3) (10,7) (1, 1, 1, 1) (27,5) (1, 1, 2, 0) (44,5) (2, 0, 0, 2) (36,4) (1, 2, 0, 1) (50,5) (2, 0, 1, 0) (64,3) (2, 0, 0, 3) (37,5) (1, 0, 1, 4) (11,8) (2, 0, 1, 1) (65,4) (2, 1, 0, 0) (121,3) (1, 0, 1, 5) (12,9) Z35 (1, 0, 0, 2, 0) (14,6) (1, 0, 0, 2, 1) (15,7) (1, 0, 0, 2, 2) (16,8) (1, 0, 1, 0, 1) (16,5) (1, 0, 1, 0, 2) (17,6) (1, 0, 0, 3, 0) (24,7) (1, 1, 0, 0, 0) (35,3) (1, 0, 1, 1, 0) (27,5) (1, 0, 1, 0, 3) (18,7) (1, 0, 0, 1, 2) (10,7) (1, 1, 0, 0, 1) (36,4) (1, 0, 1, 1, 1) (28,6) (2, 0, 0, 0, 0) (96,2) (1, 0, 2, 0, 0) (50,5) (1, 0, 0, 1, 3) (11,8) (1, 1, 0, 0, 2) (37,5) (1, 1, 0, 1, 0) (65,4) (2, 0, 0, 0, 1) (97,3) (1, 0, 0, 1, 4) (12,9) Z36 (1, 0, 0, 1, 0, 0) (16,5) (1, 0, 0, 0, 2, 0) (15,7) (1, 0, 0, 0, 2, 1) (16,8) (1, 0, 0, 0, 1, 1) (10,7) (1, 0, 0, 1, 0, 1) (17,6) (1, 0, 0, 1, 0, 2) (18,7) (1, 0, 1, 0, 0, 0) (36,4) (1, 0, 0, 1, 1, 0) (28,6) 123 D. K. Bhunia et al. Table 4 continued t =8 t =9 t = 10 (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (1, 0, 0, 0, 1, 2) (11,8) (1, 0, 1, 0, 0, 1) (37,5) (1, 1, 0, 0, 0, 0) (97,3) (1, 0, 0, 0, 1, 3) (12,9) Z37 (1, 0, 0, 0, 0, 1, 0) (10,7) (1, 0, 0, 0, 1, 0, 0) (17,6) (1, 0, 0, 0, 0, 2, 0) (16,8) (1, 0, 0, 0, 0, 1, 1) (11,8) (1, 0, 0, 0, 1, 0, 1) (18,7) (1, 0, 0, 1, 0, 0, 0) (37,5) (1, 0, 0, 0, 0, 1, 2) (12,9) Z38 (1, 0, 0, 0, 0, 0, 1, 0) (11,8) (1, 0, 0, 0, 0, 1, 0, 0) (18,7) (1, 0, 0, 0, 0, 0, 1, 1) (12,9) Z39 (1, 0, 0, 0, 0, 0, 0, 1, 0) (12,9) proved that, for 5 ≤ t ≤ 11, the improved upper bounds are equal and give the exact value s of At,2 . Let X̃ t,s,2 = |{(t1 , . . . , ts ) ∈ Ns : t + 1 = i=1 (s − i + 1)ti , t1 ≥ 2}| for s ∈ {3, . . . , (t + 1)/2 } and X̃ t,2,2 = |{(t1 , t2 ) ∈ N2 : t + 1 = 2t1 + t2 , t1 ≥ 3}|. Theorem 5 [12] For t ≥ 3,  t+1 2 At,2 ≤ 1 + X̃ t,s,2 (5) s=2 and  t+1  2 At,2 ≤ 1 + (At,s,2 − 1). (6) s=2 Moreover, for 3 ≤ t ≤ 11, the upper bounds (5) and (6) coincide and are tight. Now, we consider the case p ≥ 3 prime. In this case, we only have the following upper bounds. Theorem 6 [3] For t ≥ 3 and p ≥ 3 prime,  t−1 At, p ≤ 1 + (X t,s, p − 1) (7) s=2 and  t−1 At, p ≤ 1 + (At,s, p − 1). (8) s=2 In this paper, in order to improve the upper bounds (7) and (8), we analyze the equivalence relations among the Z ps -linear GH codes with the same length p t and different values of s. We prove that some of them are indeed permutation equivalent. For 5 ≤ t ≤ 11 if p = 2, for 4 ≤ t ≤ 10 if p = 3, and for 4 ≤ t ≤ 8 if p = 5, the ones that are permutation equivalent 123 Table 5 Rank and kernel for all nonlinear Z5s -linear GH codes of length 5t t =4 t =5 t =6 t =7 t =8 (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) Z25 (2, 1) (8,3) (2, 2) (9,4) (3, 1) (23,4) (3, 2) (24,5) (3, 3) (25,6) (3, 0) (22,3) (2, 3) (10,5) (4, 0) (57,4) (4, 1) (58,5) (2, 4) (11,6) (2, 5) (12,7) Z53 (1, 1, 0) (8,3) (2, 0, 0) (29,2) (1, 2, 0) (23,4) (1, 2, 1) (24,5) (1, 2, 2) (25,6) (1, 1, 1) (9,4) (2, 0, 1) (30,3) (2, 0, 2) (31,4) (1, 3, 0) (58,5) (1, 1, 2) (10,5) (2, 1, 0) (84,3) (2, 0, 3) (32,5) (1, 1, 3) (11,6) (2, 1, 1) (85,4) (3, 0, 0) (?,3) (1, 1, 4) (12,7) Z54 (1, 0, 1, 0) (9,4) (1, 1, 0, 0) (30,3) (1, 0, 2, 0) (24,5) (1, 0, 2, 1) (25,6) On the equivalence of Zps -linear generalized Hadamard codes (1, 0, 1, 1) (10,5) (1, 1, 0, 1) (31,4) (1, 1, 0, 2) (32,5) (2, 0, 0, 0) (134,2) (1, 1, 1, 0) (85,4) (1, 0, 1, 2) (11,6) (2, 0, 0, 1) (135,3) (1, 0, 1, 3) (12,7) Z55 (1, 0, 0, 1, 0) (10,5) (1, 0, 1, 0, 0) (31,4) (1, 0, 0, 2, 0) (25,6) (1, 0, 0, 1, 1) (11,6) (1, 0, 1, 0, 1) (32,5) (1, 1, 0, 0, 0) (135,3) (1, 0, 0, 1, 2) (12,7) Z56 (1, 0, 0, 0, 1, 0) (11,6) (1, 0, 0, 1, 0, 0) (32,5) (1, 0, 0, 0, 1, 1) (12,7) Z57 (1, 0, 0, 0, 0, 1, 0) (12,7) 123 D. K. Bhunia et al. coincide with the ones having the same invariants, rank and dimension of the kernel, that is, the same pair (r , k). Finally, by using these equivalence relations, we improve the upper bounds on the number At, p of nonequivalent Z ps -linear GH codes of length p t with p ≥ 3 prime given by Theorem 6. This allows us to determine the exact value of At, p for all t, 5 ≤ t ≤ 11, if p = 2; for all t, 4 ≤ t ≤ 10, if p = 3; and for all t, 4 ≤ t ≤ 8, if p = 5; since one of the new upper bounds coincides with the lower bound given by the number of different pairs (r , k) in these cases. 3 Equivalent Zps -linear GH codes In this section, we give some properties of the generalized Gray map φs . We also prove that, for p ≥ 3 prime, some of the Z ps -linear GH codes of the same length p t , having different values of s are permutation equivalent. Moreover, we see that they coincide with the ones having the same rank and dimension of the kernel for all t, 4 ≤ t ≤ 10, when p = 3; and for all t, 4 ≤ t ≤ 8, when p = 5. Lemma 1 Let s ≥ 2 and λi ∈ Z p , i ∈ {0, . . . , s − 1}. Then,  s−1 s−1 λi φs ( pi ) = φs ( λi pi ). i=0 i=0 Proof Straightforward from the definition of φs . Let γs ∈ S ps−1 be the permutation defined as follows: for a coordinate k = j p s−2 +i +1 ∈ {1, 2, . . . , p s−1 }, where j ∈ {0, . . . , p − 1} and i ∈ {0, . . . , p s−2 − 1}, γs moves coordinate k to coordinate j + i p + 1. Therefore, we can write γs as  1 2 ... p s−2 p s−2 + 1 p s−2 + 2 . . . p s−2 + p s−2 . . . 1 p + 1 . . . ( p s−2 − 1) p + 1 2 p + 2 . . . ( p s−2 − 1) p + 2 . . .  . . . ( p − 1) p s−2 + 1 ( p − 1) p s−2 + 2 . . . p s−1 . ... p p+ p . . . p s−1 Example 1 For p = 3 and s = 3,   123 456 789 γ3 = = (2, 4)(3, 7)(6, 8) ∈ S9 . 147 258 369 and for p = 3 and s = 4,   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 γ4 = 1 4 7 10 13 16 19 22 25 2 5 8 11 14 17 20 23 26 3 6 9 12 15 18 21 24 27 = (2, 4, 10)(3, 7, 19)(5, 13, 11)(6, 16, 20)(8, 22, 12)(9, 25, 21)(15, 17, 23) (18, 26, 24) ∈ S27 . p s−1 p Lemma 2 Let s ≥ 2, u = (0, 1, . . . , p − 1) ∈ Z p , and v = (0, 1, . . . , p − 1) ∈ Z p . Then, p s−2 γs (u) = (v, . . . , v). Proof Straightforward from the definition of γs . 123 On the equivalence of Zps -linear generalized Hadamard codes p Then, we can define the map τs : Z ps → Z ps−1 as −1 τs (u) = Φs−1 (γs−1 (φs (u))), (9) where u ∈ Z ps . Example 2 For p = 3 and s = 3, we have φ3 (0) = (0, 0, 0, 0, 0, 0, 0, 0, 0) = γ3 (0, 0, 0, 0, 0, 0, 0, 0, 0) = γ3 (Φ2 (0, 0, 0)), φ3 (1) = (0, 1, 2, 0, 1, 2, 0, 1, 2) = γ3 (0, 0, 0, 1, 1, 1, 2, 2, 2) = γ3 (Φ2 (0, 3, 6)), φ3 (2) = (0, 2, 1, 0, 2, 1, 0, 2, 1) = γ3 (0, 0, 0, 2, 2, 2, 1, 1, 1) = γ3 (Φ2 (0, 6, 3)), φ3 (3) = (0, 0, 0, 1, 1, 1, 2, 2, 2) = γ3 (0, 1, 2, 0, 1, 2, 0, 1, 2) = γ3 (Φ2 (1, 1, 1)), φ3 (4) = (0, 1, 2, 1, 2, 0, 2, 0, 1) = γ3 (0, 1, 2, 1, 2, 0, 2, 0, 1) = γ3 (Φ2 (1, 4, 7)) φ3 (5) = (0, 2, 1, 1, 0, 2, 2, 1, 0) = γ3 (0, 1, 2, 2, 0, 1, 1, 2, 0) = γ3 (Φ2 (1, 7, 4)), φ3 (6) = (0, 0, 0, 2, 2, 2, 1, 1, 1) = γ3 (0, 2, 1, 0, 2, 1, 0, 2, 1) = γ3 (Φ2 (2, 2, 2)), φ3 (7) = (0, 1, 2, 2, 0, 1, 1, 2, 0) = γ3 (0, 2, 1, 1, 0, 2, 2, 1, 0) = γ3 (Φ2 (2, 5, 8)), φ3 (8) = (0, 2, 1, 2, 1, 0, 1, 0, 2) = γ3 (0, 2, 1, 2, 1, 0, 1, 0, 2) = γ3 (Φ2 (2, 8, 5)), φ3 (9) = (1, 1, 1, 1, 1, 1, 1, 1, 1) = γ3 (1, 1, 1, 1, 1, 1, 1, 1, 1) = γ3 (Φ2 (3, 3, 3)), φ3 (10) = (1, 2, 0, 1, 2, 0, 1, 2, 0) = γ3 (1, 1, 1, 2, 2, 2, 0, 0, 0) = γ3 (Φ2 (3, 6, 0)), φ3 (11) = (1, 0, 2, 1, 0, 2, 1, 0, 2) = γ3 (1, 1, 1, 0, 0, 0, 2, 2, 2) = γ3 (Φ2 (3, 0, 6)), φ3 (12) = (1, 1, 1, 2, 2, 2, 0, 0, 0) = γ3 (1, 2, 0, 1, 2, 0, 1, 2, 0) = γ3 (Φ2 (4, 4, 4)), φ3 (13) = (1, 2, 0, 2, 0, 1, 0, 1, 2) = γ3 (1, 2, 0, 2, 0, 1, 0, 1, 2) = γ3 (Φ2 (4, 7, 1)), φ3 (14) = (1, 0, 2, 2, 1, 0, 0, 2, 1) = γ3 (1, 2, 0, 0, 1, 2, 2, 0, 1) = γ3 (Φ2 (4, 1, 7)), φ3 (15) = (1, 1, 1, 0, 0, 0, 2, 2, 2) = γ3 (1, 0, 2, 1, 0, 2, 1, 0, 2) = γ3 (Φ2 (5, 5, 5)), φ3 (16) = (1, 2, 0, 0, 1, 2, 2, 0, 1) = γ3 (1, 0, 2, 2, 1, 0, 0, 2, 1) = γ3 (Φ2 (5, 8, 2)), φ3 (17) = (1, 0, 2, 0, 2, 1, 2, 1, 0) = γ3 (1, 0, 2, 0, 2, 1, 2, 1, 0) = γ3 (Φ2 (5, 2, 8)), φ3 (18) = (2, 2, 2, 2, 2, 2, 2, 2, 2) = γ3 (2, 2, 2, 2, 2, 2, 2, 2, 2) = γ3 (Φ2 (6, 6, 6)), φ3 (19) = (2, 0, 1, 2, 0, 1, 2, 0, 1) = γ3 (2, 2, 2, 0, 0, 0, 1, 1, 1) = γ3 (Φ2 (6, 0, 3)), φ3 (20) = (2, 1, 0, 2, 1, 0, 2, 1, 0) = γ3 (2, 2, 2, 1, 1, 1, 0, 0, 0) = γ3 (Φ2 (6, 3, 0)), φ3 (21) = (2, 2, 2, 0, 0, 0, 1, 1, 1) = γ3 (2, 0, 1, 2, 0, 1, 2, 0, 1) = γ3 (Φ2 (7, 7, 7)), φ3 (22) = (2, 0, 1, 0, 1, 2, 1, 2, 0) = γ3 (2, 0, 1, 0, 1, 2, 1, 2, 0) = γ3 (Φ2 (7, 1, 4)), φ3 (23) = (2, 1, 0, 0, 2, 1, 1, 0, 2) = γ3 (2, 0, 1, 1, 2, 0, 0, 1, 2) = γ3 (Φ2 (7, 4, 1)), φ3 (24) = (2, 2, 2, 1, 1, 1, 0, 0, 0) = γ3 (2, 1, 0, 2, 1, 0, 2, 1, 0) = γ3 (Φ2 (8, 8, 8)), φ3 (25) = (2, 0, 1, 1, 2, 0, 0, 1, 2) = γ3 (2, 1, 0, 0, 2, 1, 1, 0, 2) = γ3 (Φ2 (8, 2, 5)), φ3 (26) = (2, 1, 0, 1, 0, 2, 0, 2, 1) = γ3 (2, 1, 0, 1, 0, 2, 0, 2, 1) = γ3 (Φ2 (8, 5, 2)). These equalities define the map τ3 : Z27 → Z39 as τ3 (0) = (0, 0, 0), τ3 (9) = (3, 3, 3), τ3 (18) = (6, 6, 6), τ3 (1) = (0, 3, 6), τ3 (10) = (3, 6, 0), τ3 (19) = (6, 0, 3), τ3 (2) = (0, 6, 3), τ3 (11) = (3, 0, 6), τ3 (20) = (6, 3, 0), τ3 (3) = (1, 1, 1), τ3 (12) = (4, 4, 4), τ3 (21) = (7, 7, 7), τ3 (4) = (1, 4, 7), τ3 (13) = (4, 7, 1), τ3 (22) = (7, 1, 4), τ3 (5) = (1, 7, 4), τ3 (14) = (4, 1, 7), τ3 (23) = (7, 4, 1), τ3 (6) = (2, 2, 2), τ3 (15) = (5, 5, 5), τ3 (24) = (8, 8, 8), τ3 (7) = (2, 5, 8), τ3 (16) = (5, 8, 2), τ3 (25) = (8, 2, 5), τ3 (8) = (2, 8, 5), τ3 (17) = (5, 2, 8), τ3 (26) = (8, 5, 2). s−1 Lemma 3 [3] Let s ≥ 2 and λ ∈ Z p . Then, φs (λ p s−1 ) = (λ, p. . . , λ). Lemma 4 Let s ≥ 2. Then, (i) τs (1) = (0, p s−2 , . . . , ( p − 1) p s−2 ), (ii) τs ( pi u) = pi−1 (u, . p. ., u) for i ∈ {1, . . . , s − 1} and u ∈ {0, 1, . . . , p s−1 − 1} ⊆ Z ps . p Proof First, let v = (0, 1, . . . , p − 1) ∈ Z p . Then, −1 τs (1) = Φs−1 (γs−1 (φs (1))) −1 (γs−1 (v, p. . . , v)) s−2 = Φs−1 −1 = Φs−1 (0, 1, . . . , p − 1), by Lemma 2. 123 D. K. Bhunia et al. Finally, by Lemma 3, τs (1) = (0, p s−2 , . . . , ( p − 1) p s−2 ), and (i) holds. In order to prove (ii), let u ∈ Z ps and [u 0 , . . . , u s−1 ] p be its p-ary expansion. The p-ary s−1 expansion of pi u is [0, . i. ., 0, u 0 , . . . , u s−i−1 ] p and we have that φs ( pi u) = (u s−i−1 , p. . . , u s−i−1 ) + (0, . i. ., 0, u 0 , . . . , u s−i−2 )Ys−1 . Recall that the matrix Ys−1 given in (1), related to the definition of φs , is a matrix of size (s − 1) × p s−1 whose columns are the elements of Zs−1 p . Moreover, we consider that the columns of Ys−1 are ordered in ascending order, by considering the elements of Zs−1 p as the p-ary expansions of the elements of Z p s−1 . Therefore, Ys is also the matrix obtained recursively from Y1 = (0 1 · · · p − 1) and   Ys−1 Ys−1 · · · Ys−1 Ys = . 0 1 ··· p − 1 By Lemma 2, we can write   0 1 ··· p − 1 γs−1 (Ys−1 ) = . Ys−2 Ys−2 · · · Ys−2 Then, we have that γs−1 (φs ( pi u))   s−1 ··· p − 1 0 1 = (u s−i−1 , p. . . , u s−i−1 ) + (0, . i. ., 0, u 0 , . . . , u s−i−2 ) Ys−2 Ys−2 · · · Ys−2 s−1   . . ., 0, u 0 , . . . , u s−i−2 ) Ys−2 Ys−2 · · · Ys−2 = (u s−i−1 , p. . . , u s−i−1 ) + (0, i−1 = (φs−1 ( pi−1 u), . p. ., φs−1 ( pi−1 u)) = Φs−1 ( pi−1 (u, . p. ., u)). −1 Therefore, τs ( pi u) = Φs−1 (γs−1 (φs ( pi u))) = pi−1 (u, . p. ., u), and (ii) holds. Proposition 1 Let s ≥ 2 and λi ∈ {0, 1, . . . , p − 1}, i ∈ {0, . . . , s − 1}. Then,  s−1  s−1 φs λi pi = γs Φs−1 τs λi pi . (10) i=0 i=0 Proof By Lemma 4, we know that for all i ∈ {1, . . . , s − 1}, τs ( pi ) = ( pi−1 , . p. ., pi−1 ) and τs (1) = (0, p s−2 , . . . , ( p − 1) p s−2 ). Then, by Lemma 1, we have that  s−1  s−1 γs Φs−1 τs (λi pi ) = γs Φs−1 τs (λi pi ) . i=0 i=0 Moreover, γs commutes with the addition. Therefore, by applying the definition of the map τs given in (9), we obtain that  s−1  s−1  s−1   γs Φs−1 τs (λi pi ) = γs Φs−1 τs (λi pi ) = φs λi pi , i=0 i=0 i=0 s−1 which is equal to φs ( i=0 λi pi ) by Lemma 1. Corollary 1 Let s ≥ 2 and λi ∈ {0, 1, . . . , p − 1}, i ∈ {0, . . . , s − 1}. Then,  s−1  s−1 τs λi pi = τs (λi pi ). (11) i=0 i=0 123 On the equivalence of Zps -linear generalized Hadamard codes Proof By Proposition 1, we have that  s−1  s−1 φs λi pi = γs Φs−1 τs (λi pi ) , i=0 i=0 and, therefore, s−1  s−1   −1 Φs−1 γs−1 φs ( λi pi ) = τs λi pi , i=0 i=0 s−1 s−1 that is, τs ( i=0 λi pi ) = i=0 τs (λi pi ). Now, we extend the permutation γs ∈ S ps−1 to a permutation γs ∈ S ps−1 n such that, if we restrict this extended permutation to each set of p s−1 coordinates { p s−1 i + 1, p s−1 i + 2, . . . , p s−1 (i + 1)}, i ∈ {0, . . . , n − 1}, it acts as γs ∈ S ps−1 . That is, the extended permutation γs ∈ S ps−1 n can be seen as n consecutive copies of γs ∈ S ps−1 . Then, we component-wise extend function τs defined in (9) to τs : Znps → Z ps−1 and define τ̃s = ρ −1 ◦ τs , where pn ρ ∈ S pn is defined as follows: for a coordinate k = jn + i + 1 ∈ {1, 2, . . . , pn}, where i ∈ {0, . . . , n − 1} and j ∈ {0, . . . , p − 1}, ρ moves coordinate k to coordinate i p + j + 1. Therefore, we can write ρ as  1 2 ... n n + 1 n + 2 ... 2n ... 1 p + 1 . . . (n − 1) p + 1 2 p + 2 . . . (n − 1) p + 2 . . .  . . . pn − n + 1 pn − n + 2 . . . pn . ... p p + p . . . pn Example 3 For p = 3 and n = 2,   12 34 56 ρ= ∈ S6 . 14 25 36 and for p = 3 and n = 4,   1 2 3 4 5 6 7 8 9 10 11 12 ρ= ∈ S12 . 1 4 7 10 2 5 8 11 3 6 9 12 Remark 1 If u = (u 1 , u 2 , . . . , u n ) ∈ Znps and τs (u i ) = (u i,1 , u i,2 , . . . , u i, p ) for all i ∈ {1, . . . , n}, then τs (u) = (u 1,1 , u 1,2 , . . . , u 1, p , u 2,1 , u 2,2 , . . . , u 2, p , . . . , u n,1 , u n,2 , . . . , u n, p ), and τ̃s (u) = (u 1,1 , u 2,1 , . . . , u n,1 , u 1,2 , u 2,2 , . . . , u n,2 , . . . , u 1, p , u 2, p , . . . , u n, p ). Lemma 5 Let s ≥ 2. Then, Φs (u) = γs (Φs−1 (ρ(τ̃s (u)))) for all u ∈ Znps . Proof From the definition of τs given in (9) and the definition of τ̃s = ρ −1 ◦ τs , we have that −1 τ̃s (u) = ρ −1 (τs (u)) = ρ −1 (Φs−1 (γs−1 (Φs (u)))). Then, the result follows.  A p-linear combination of the elements of a set B = {b1 , . . . , br } ⊆ Znps is ri=1 λi bi for λi ∈ Z p . We say that B is a p-basis of C if the elements in B are p-linearly independent (s) and any c ∈ C is a p-linear combination of the elements of B. Let wi be the i-th row of 123 D. K. Bhunia et al. (s) (s) (s) Atp1 ,...,ts , 1 ≤ i ≤ t1 + · · · + ts . By construction, w1 = 1 and o(wi ) ≤ o(w j ) if i > j. (s) (s) Let σi be the integer such that = p σi . Then, we have that Bt1 ,...,ts = { pqi wi o(wi ) :1≤ i ≤ t1 + · · · + ts , 0 ≤ qi ≤ σi − 1} is a p-basis of Htp1 ,...,ts . Example 4 Let H32,1 and H31,1,0 be the Z9 -additive and Z27 -additive GH codes, which are generated by ⎛ (2) ⎞ ⎛ ⎞ w1 111 ⎜ (2) ⎟ ⎝ A2,1 3 = ⎝ w2 ⎠ = v v v⎠, (2) 036 w3 where v = (0, 1, 2, 3, 4, 5, 6, 7, 8), and (3)   w1 1111 1 1 1 1 1 A1,1,0 3 = (3) = , w2 0 3 6 9 12 15 18 21 24 respectively. The corresponding 3-bases are (2) (2) (2) (2) (2) B2,1 = {w1 , 3w1 , w2 , 3w2 , w3 } = {1, 3, (v, v, v), (0, 3, 6, . 9. ., 0, 3, 6), (0, . 9. ., 0, 3, . 9. ., 3, 6, . 9. ., 6)}, and (3) (3) (3) (3) (3) B1,1,0 = {w1 , 3w1 , 9w1 , w2 , 3w2 } = {1, 3, 9, (0, 3, 6, 9, 12, 15, 18, 21, 24), (0, 9, 18, 0, 9, 18, 0, 9, 18)}. (s) (s+1) Lemma 6 Let s ≥ 2 and ts ≥ 1. Let wi and wi be the i-th row of Atp1 ,...,ts and 1,t1 −1,t2 ,...,ts−1 ,ts −1 (s+1) p (s+1) (s) (s) Ap , respectively. Then, (wi , . . ., wi ) = pwi and o(wi ) = (s+1) σ o(wi ) = p i. (s) Proof Consider Atp1 ,...,ts with ts ≥ 1, and wi its i-th row for i ∈ {1, . . . , t1 + · · · + ts }. Then, the matrix over Z ps+1 ⎛ (s) ⎞ w1 ⎜ (s) ⎟ ⎜ pw2 ⎟ ⎜ .. ⎟ ⎜ ⎟ ⎝ . ⎠ (s) pwt1 +···+ts 1 −1,t2 ,...,ts is, by definition, A1,t p . Moreover, by the construction given in (2), we have that 1,t1 −1,t2 ,...,ts Ap is the matrix  1,t1 −1,t2 ,...,ts−1 ,ts −1 1,t1 −1,t2 ,...,ts−1 ,ts −1 1,t −1,t ,...,t ,t −1  Ap Ap · · · A p 1 2 s−1 s . ps · 0 ps · 1 ··· p s · (p − 1) (s+1) 1,t −1,t ,...,t ,t −1 Therefore, if wi is the i-th row of A p 1 2 s−1 s for i ∈ {2, . . . , t1 +t2 +· · ·+ts −1}, (s+1) p (s+1) (s) (s) (s+1) we have that (wi , . . ., wi ) = pwi and o(wi ) = o(wi ) = p σi . 1,t −1,t ,...,t ,t −1 Proposition 2 Let s ≥ 2, ts ≥ 1, and Htp1 ,...,ts and H p 1 2 s−1 s be the Z ps -additive 1,t −1,t ,...,t ,t −1 and Z ps+1 -additive GH codes with generator matrices Atp1 ,...,ts and A p 1 2 s−1 s , (s) (s+1) 1,t1 −1,t2 ,...,ts−1 ,ts −1 respectively. Let wi and wi be the i-th row of Atp1 ,...,ts and A p , respec- tively. Then, we have that 123 On the equivalence of Zps -linear generalized Hadamard codes (s+1) (s) (i) τ̃s+1 ( pqi wi ) = pqi wi , for all i ∈ {2, . . . , t1 +· · ·+ts −1} and qi ∈ {0, . . . , σi −1}, (s) where o(wi ) = p σi ; (s+1) (s) (ii) τ̃s+1 ( p j+1 w1 ) = p j w1 , for all j ∈ {0, . . . , s − 1}; (s+1) (s) (iii) τ̃s+1 (w1 ) = wt1 +···+ts . (s+1) (s+1) (s) (s) (s+1) Proof By Lemma 6, we have that (wi , . p. ., wi ) = pwi and o(wi ) = o(wi )= σ (s+1) (s+1) (s+1) (s) (s+1) p p . Let vi i be the vector over Z ps+1 such that wi = pvi and wi = (vi ,... (s+1) (s+1) (s+1) , vi ). Let (vi ) j be the jth coordinate of vi . By the definition of τ̃s+1 and Lemma 4, for qi ∈ {0, . . . , σi − 1}, we have that  (s+1)   (s+1)   (s+1)  τ̃s+1 pqi wi = ρ −1 τs+1 ( pqi wi ) = ρ −1 τs+1 ( pqi +1 vi )     s+1  p  (s+1)   (s+1)  p  (s+1)   = ρ −1 pqi vi 1 , . . ., vi 1 , . . . , vi n , . . ., vi n  qi (s+1) p (s+1)  qi (s) = p vi , . . ., vi = p wi , and (i) holds.  (s) (s+1) p (s+1)  (s) Since w1 = w1 , . . ., w1 = 1 and wt1 +···+ts = ( p s−1 · 0, p s−1 · 1, . . . , p s−1 · (p − 1)), then the equalities in items (ii) and (iii) hold by the definition of τ̃s+1 and Lemma 4. Note that, by Proposition 2, we have that τ̃s+1 is a bijection between the p-bases, Bt1 ,...,ts and B1,t1 −1,...,ts−1 ,ts −1 . Example 5 Let H32,1 and H31,1,0 be the same codes considered in Example 4. The length of 1,1,0 H3 is n = 9. Then, the extension of γ3 = (2, 4)(3, 7)(6, 8) ∈ S9 defined in Example 1 is γ3 =(2, 4)(3, 7)(6, 8)(11, 13)(12, 16)(15, 17)(20, 22)(21, 25)(24, 26)(29, 31)(30, 34) (33, 35)(38, 40)(39, 43)(42, 44)(47, 49)(48, 52)(51, 53)(56, 58)(57, 61)(60, 62) (65, 67)(66, 70)(69, 71)(74, 76)(75, 79)(78, 80) ∈ S81 , and  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ρ= 1 4 7 10 13 16 19 22 25 2 5 8 11 14 17 20  17 18 19 20 21 22 23 24 25 26 27 ∈ S27 . 23 26 3 6 9 12 15 18 21 24 27 In this case, by using the equalites given in Example 2, we have that Φ3 (1, 1, 1, 1, 1, 1, 1, 1, 1) = γ3 (Φ2 (u, . 9. ., u)) = γ3 (Φ2 (ρ(0, 3, 6))), Φ3 (3, 3, 3, 3, 3, 3, 3, 3, 3) = γ3 (Φ2 (1, .27 . ., 1)) = γ3 (Φ2 (ρ(1, .27 . ., 1))), Φ3 (9, 9, 9, 9, 9, 9, 9, 9, 9) = γ3 (Φ2 (3, .27 . ., 3)) = γ3 (Φ2 (ρ(3, .27 . ., 3))), Φ3 (0, 3, 6, 9, 12, 15, 18, 21, 24) = γ3 (Φ2 (0, 0, 0, 1, 1, 1, . . . , 8, 8, 8)) = γ3 (Φ2 (ρ(v, v, v)), Φ3 (0, 9, 18, 0, 9, 18, 0, 9, 18) = γ3 (Φ2 (w, w, w)) = γ3 (Φ2 (ρ(u, . 9. ., u))), where u = (0, 3, 6), v = (0, 1, 2, 3, 4, 5, 6, 7, 8) and w = (0, 0, 0, 3, 3, 3, 6, 6, 6). 123 D. K. Bhunia et al. Since Φ3 (u) = γ3 (Φ2 (ρ(τ̃3 (u)))) for all u ∈ Z927 , the map τ̃3 sends the elements of the 3-basis B1,1,0 into the elements of the 3-basis B2,1 . That is, as it is shown in Proposition 2, (3) (2) τ̃3 (w1 ) = τ̃3 (1, 1, 1, 1, 1, 1, 1, 1, 1) = (0, 3, 6) = w3 , (3) (2) τ̃3 (3w1 ) = τ̃3 (3, 3, 3, 3, 3, 3, 3, 3, 3) = (1, .27. ., 1) = w1 , (3) (2) τ̃3 (9w1 ) = τ̃3 (9, 9, 9, 9, 9, 9, 9, 9, 9) = (3, .27. ., 3) = 3w1 , (3) (2) τ̃3 (w2 ) = τ̃3 (0, 3, 6, 9, 12, 15, 18, 21, 24) = (v, v, v) = w2 , (3) (2) τ̃3 (3w2 ) = τ̃3 (0, 9, 18, 0, 9, 18, 0, 9, 18) = (u, . 9. ., u) = 3w2 , so τ̃3 is a bijection between both 3-bases. Lemma 7 Let Hs = Htp1 ,...,ts be a Z ps -additive GH code with s ≥ 2 and ts ≥ 1. Then, Hs = Φs (Hs ) is permutation equivalent to Hs+1 = Φs+1 (Hs+1 ), where Hs+1 = 1,t −1,t2 ,...,ts−1 ,ts −1 Hp 1 , which is a Z ps+1 -linear GH code. (s) (s) Proof Note that Hs and Hs+1 both have the same length p t . Let Bs = {v1 , . . . , vt+1 } and (s+1) (s+1) Bs+1 = {v1 , . . . , vt+1 } be the p-basis of Hs and Hs+1 , respectively. By Proposition 2, τ̃s+1 is a bijection between Bs and Bs+1 . By the definition of τ̃s+1 and Corollary 1, we have that τ̃s+1 commutes with the addition, so τ̃s+1 (Hs+1 ) = Hs . Let ρ∗ ∈ S pt be a permutation such that Φs (ρ(u)) = ρ∗ (Φs (u)) for all u ∈ Hs . −1 Since Hs = τ̃s+1 (Hs+1 ) = ρ −1 (Φs−1 (γs+1 (Φs+1 (Hs+1 )))), we have that Φs (Hs ) = −1 ρ∗−1 (γs+1 (Φs+1 (Hs+1 ))). Therefore, we obtain Hs = (γs+1 ◦ρ∗ )−1 (Hs+1 ), where γs+1 ◦ρ∗ ∈ S pt . Theorem 7 determines which Z ps -linear GH codes are equivalent to a given Z ps -linear GH code H pt1 ,...,ts . We denote by 0 j the all-zero vector of length j. Theorem 7 Let H pt1 ,...,ts be a Z ps -linear GH code with s ≥ 2 and ts ≥ 1. Then, H pt1 ,...,ts is permutation equivalent to the Z ps+ -linear GH code −1 ,t −1,t ,...,t 1,0 s−1 ,ts − Hp 1 2 , for all ∈ {1, . . . , ts }. −1 ,t −1,t ,...,t ,t − Proof Consider H0 = Htp1 ,...,ts and H = H p 1,0 1 2 s−1 s for ∈ {1, . . . , ts }. By Lemma 7, we have that Hi = Φ(Hi ) is permutation equivalent to Hi+1 = Φ(Hi+1 ) for all i ∈ {0, . . . , − 1} and ∈ {1, . . . , ts }. Therefore, we have that H0 and H are permutation equivalent for all ∈ {1, . . . , ts }. Let t1 , t2 , . . . , ts be nonnegative integers with t1 ≥ 2, or t1 = 1 and s = 2. Let C p (t1 , . . . , ts ) = [H1 = H pt1 ,...,ts , H2 , . . . , Hρ ] be the sequence of all Z ps -linear GH codes s of length p t , where t = ( i=1 (s − i + 1) · ti ) − 1, that are permutation equivalent to t1 ,...,ts Hp by Theorem 7. We denote by C p (t1 , . . . , ts )[i] the i-th code Hi in the sequence, for 1 ≤ i ≤ ts + 1. We consider that the codes in C p (t1 , . . . , ts ) are ordered as follows:  t ,...,t H p1 s if i = 1, C p (t1 , . . . , ts )[i] = 1,0i−2 ,t1 −1,t2 ,...,ts−1 ,ts −i+1 (12) Hp otherwise. We refer to C p (t1 , . . . , ts ) as the chain of equivalences of H pt1 ,...,ts . 123 On the equivalence of Zps -linear generalized Hadamard codes Remark 2 First, note that if ts = 0, then C p (t1 , . . . , ts ) = [H pt1 ,...,ts ]. Moreover, there are no two different codes in the chain C p (t1 , . . . , ts ) that have the same value of s. Finally, also by construction, if there is only one Z p2 -linear GH code in the chain C p (t1 , . . . , ts ), then it is placed in the first position and s = 2. Corollary 2 Let C p (t1 , . . . , ts ) be the chain of equivalences of H pt1 ,...,ts , where t1 ≥ 2, or t1 = 1 and s = 2. Then, |C p (t1 , . . . , ts )| = ts + 1. Since all the codes in a given chain C p (t1 , . . . , ts ) are equivalent, we have that if one of the codes in a chain is linear, then all the codes in that chain are also linear. The following result gives the conditions on the values t1 , . . . , ts so that the chain C p (t1 , . . . , ts ) contains linear codes. In fact, we have that this chain contains linear Z ps -linear codes of a certain length for any s ∈ {2, . . . , t + 1}. Theorem 8 Let C p (t1 , . . . , ts ) be the chain of equivalences of H pt1 ,...,ts . Then, for all H ∈ C p (t1 , . . . , ts ), H is linear if and only if s = 2 and one of the following conditions is satisfied: (i) p = 2 and t1 ∈ {1, 2}, (ii) p ≥ 3 prime and t1 = 1. t ,...,t Proof First, assume that H is linear for all H ∈ C p (t1 , . . . , ts ). Let H p1 s ∈ C p (t1 , . . . , ts ). If s = 2, then (t1 , t2 ) = (t1 , t2 ) by Remark 2, and we have that p = 2 and t1 ∈ {1, 2} by Theorem 1, or p ≥ 3 prime and t1 = 1 by Theorem 3. Now, assume that s > 2. By Theorems t ,...,ts 1,0s −2 ,t t ,...,ts 1,0s −3 ,1,t 2 and 3, we have that H p1 = Hp s for p prime, or H p1 = H2 s . By 1,0s −2 ,ts 1,t +s −2 1,0s −3 ,1,t Theorem 7, H p is equivalent to H p s for p prime, and H2 s is equivalent 2,ts +s −2 to H2 . Therefore, by Remark 2, we have that s = 2 and one of the conditions in the statement is satisfied. The converse result follows from the definition of the chain of equivalences C p (t1 , . . . , ts ) and Theorems 1 and 3. Corollary 3 Let t ≥ 2. If p = 2, then there are two different linear chains of equivalences, C2 (1, t − 1) and C2 (2, t − 3). If p ≥ 3 prime, then there is a unique linear chain of equivalences, C p (1, t − 1). Proof From Theorem 8, if C p (t1 , . . . , ts ) is a linear chain of equivalences, then s = 2. Moreover, we have that the codes in C p (t1 , t2 ) are of length p t , where t = 2t1 + t2 − 1. The possible values of t1 are also given in Theorem 8 depending on the value of p as follows. First, if p = 2, we have that t1 ∈ {1, 2}. Therefore, if t1 = 1, then the chain is C2 (1, t − 1); and if t1 = 2, then the chain is C2 (2, t − 3). Second, if p ≥ 3 prime, then t1 = 1 and the chain is C p (1, t − 1). Example 6 The chain of equivalences of H31,5 is C3 (1, 5) = [H31,5 , H31,0,4 , H31,0,0,3 , H31,0,0,0,2 , H31,0,0,0,0,1 , H31,0,0,0,0,0 ] and it contains exactly t2 + 1 = 6 codes. Note that (t1 , t2 ) = (1, 5) satisfies the second condition of Theorem 8. Thus, this chain contains linear GH codes. They are all the linear GH codes over Z3 of length 3t = 36 and dimension t + 1 = 7 as seen in Table 2. 123 D. K. Bhunia et al. Example 7 From one hand, the chain of equivalences of H21,4 is C2 (1, 4) = [H21,4 , H21,0,3 , H21,0,0,2 , H21,0,0,0,1 , H21,0,0,0,0,0 ] and it contains t2 + 1 = 5 codes. From the other hand, the chain of equivalence of H22,2 is C2 (2, 2) = [H22,2 , H21,1,1 , H21,0,1,0 ] and it contains exactly t2 + 1 = 3 codes. Note that the values of (t1 , t2 ) in both cases, (1, 4) and (2, 2), satisfy the first condition of Theorem 8, so these chains contain linear Hadamard codes. In fact, the sequences C2 (1, 4) and C2 (2, 2) contain all the linear Hadamard codes of length of 2t = 25 and dimension t + 1 = 6 as can be seen in Table 1. Therefore, all the codes in these chains are permutation equivalent to each other. (s) (s) Recall that w2 is the second row of Atp1 ,...,ts . Let σ be the integer such that o(w2 ) = p s+1−σ . For H1,0,...,0 p , we define σ = s. Note that σ = 1 if and only if t1 ≥ 2, and σ = min{i : ti > 0, i ∈ {2, . . . , s}} if t1 = 1. Then, σ ∈ {1, . . . , s}. We say that o(Htp1 ,...,ts ) = σ ; or equivalently, o(H pt1 ,...,ts ) = σ . Note that if σ = s, then H pt1 ,...,ts = H p1,0,...,0,ts with s ≥ 2 and ts ≥ 0, so it is linear by Theorems 1, 2, and 3. Moreover, since σ2 is the integer such that (s) o(w2 ) = p σ2 , we have that σ = s + 1 − σ2 . If we focus on the chains of equivalences C p (t1 , . . . , ts ) having nonlinear codes, then we can assume that t1 ≥ 2 by Theorem 8. Proposition 3 Let C p (t1 , . . . , ts ) be the chain of equivalences of H pt1 ,...,ts , where t1 ≥ 2. If H pt1 ,...,ts is nonlinear, then for all H ∈ C p (t1 , . . . , ts ),  s i=1 ti if p ≥ 3 prime, ker(H ) = s 1 + i=1 ti if p = 2. Proof Since t1 ≥2, then σ = 1. By  [3, Theorem 4], for p ≥ 3 prime, we have that ker(H pt1 ,...,ts ) = ( i=1 s ti ) + σ − 1 = i=1 s ti . Note that for p = 2 and s > 2, H2t1 ,...,ts isnonlinear by Theorems 2. Thus, by [11, Theorem 3], we have that ker(H2t1 ,...,ts ) = σ + s ( i=1 ti ) = 1 + i=1 ti . Therefore, the result follows from the definition of the chain of equivalences C p (t1 , . . . , ts ). Example 8 The chain of equivalences of H32,5 is the sequence C3 (2, 5) = [H32,5 , H31,1,4 , H31,0,1,3 , H31,0,0,1,2 , H31,0,0,0,1,1 , H31,0,0,0,0,1,0 ] and contains exactly t2 +1 = 6 codes. Note that this sequence contains all the codes of length 38 having the pair (r , k) = (10, 7) in Table 4. In the same table, note that there is only one code of length 39 having the pair (r , k) = (43, 4), named H32,2,0 . Therefore, C3 (2, 2, 0) = [H32,2,0 ], which contains just this code, since t3 + 1 = 1. Example 9 Consider the chains of equivalences C3 (4, 1) = [H34,1 , H31,3,0 ] and C3 (2, 0, 3) = [H32,0,3 , H31,1,0,2 , H31,0,1,0,1 , H31,0,0,1,0,0 ]. Note that, from Proposition 3, the codes in both chains have dimension of the kernel equals to 5. However, from Table 4, we have that the pair (r , k) is (22, 5) for codes in C3 (4, 1), and (16, 5) for codes in C3 (2, 0, 3). Therefore, codes in C3 (4, 1) are not equivalent to codes in C3 (2, 0, 3). Proposition 4 Let C p (t1 , . . . , ts ) be the chain of equivalences of H pt1 ,...,ts . Then, the Z ps - t ,...,ts linear GH code H p1 = C p (t1 , . . . , ts )[i], 1 ≤ i ≤ ts + 1, satisfies 123 On the equivalence of Zps -linear generalized Hadamard codes (i) s = s + i − 1, (ii) σ = i, (iii) ts = ts − i + 1,  (t1 , . . . , ts ) if i = 1, (iv) (t1 , . . . , ts ) = (1, 0 , t1 − 1, t2 , . . . , ts−1 , ts − i + 1) otherwise. i−2 Proof Straightforward from Theorem 7 and the definition of the chain of equivalences C p (t1 , . . . , ts ). t ,...,ts Note that the value of s is different for every code H p1 belonging to the same chain of equivalences C p (t1 , . . . , ts ) as pointed out in Remark 2. Corollary 4 Let C p (t1 , . . . , ts ) be the chain of equivalences of H pt1 ,...,ts . Then, t ,...,ts (i) if t1 ≥ 2, the Z ps -linear GH code H p1 = C p (t1 , . . . , ts )[1] is the only one in C p (t1 , . . . , ts ) with t1 ≥ 2; t ,...,ts (ii) the Z ps -linear GH code H p1 = C p (t1 , . . . , ts )[ts + 1] is the only one in C p (t1 , . . . , ts ) with ts = 0; and t ,...,ts (iii) if t1 = 1 and s = 2, every H p1 ∈ C p (t1 , . . . , ts ) satisfies t1 = 1. Now, given any Z ps -linear GH code H pt1 ,...,ts , we determine the chain of equivalences containing this code, as well as its position in the sequence. Therefore, note that indeed we prove that any code H pt1 ,...,ts (with t1 ≥ 1) belongs to a unique chain of equivalences C p (t1 , . . . , ts ) with t1 ≥ 2 or t1 = 1 and s = 2. Theorem 9 Let H = H pt1 ,...,ts , p prime, and σ = o(H ). Let ∈ {1, . . . , s − 1} such that t ,0 −1 ,t +1 ,...,ts H= H p1 , where t +1 = 0 if < s − 1. Then, H belongs to an unique chain of equivalences, and it satisfies one of the following conditions: (i) if t1 ≥ 2, then σ = 1 and H = C p (t1 , . . . , ts )[1]. (ii) if t1 = 1 and = s − 1, then σ = s and H = C p (1, ts + − 1)[σ − 1]. (iii) if t1 = 1 and < s −1, then σ = +1 and H = C p (t1 , . . . , ts )[σ ], where (t1 , . . . , ts ) = (tσ + 1, tσ +1 , . . . , ts−1 , ts + σ − 1) and s = s − σ + 1. Proof Item (i) follows from Corollary 4 (i). For Item (ii), we have that H pt1 ,...,ts = H p1,0 s−2 ,t s s−2 ,t and hence σ = s. We have that H p1,0 s is a linear Z ps -linear GH code by Theorems 1, 2 and H p1,0 ,ts s−2 s−2 ,t 3. Since is linear, then by Theorem 8, H p1,0 s ∈ C p (t1 , t2 ), where t1 ∈ {1, 2} if p = 2 and t1 = 1 if p ≥ 3 prime. By Theorem 7, we have that H p1,0 ,ts = C p (1, ts + −1)[ ] s−2 for p prime. Moreover, since no code in the chain C2 (2, t2 ) has (t1 , . . . , ts ) = (1, 0s−2 , ts ), H21,0 ,ts ∈ s−2 / C2 (2, t2 ). For Item (iii), since t1 = 1 and < s − 1, we have that t +1 = 0 and hence σ = + 1. By Theorem 7, we have that H pt1 ,...,ts = C p (t1 , . . . , ts )[ +1]. Since = σ −1, by Proposition 4 we have that (t1 , . . . , ts ) = (1, 0σ −2 , t1 −1, t2 , . . . , ts −1 , ts −σ +1). Therefore, tσ = t1 −1, tσ +1 = t2 , . . ., ts−1 = ts −1 , ts = ts − σ + 1, and the result follows. Note that, in Theorem 9, the values of (t1 , . . . , ts ) satisfying Item (ii) for p prime corre- spond to linear Z ps -linear GH codes. 123 D. K. Bhunia et al. Table 6 Type of all Z ps -linear t =5 (3,0), (2,0,0) GH codes of length p t with t1 ≥ 2 (equivalently, σ = 1) and t =7 (4,0), (2,1,0), (2,0,0,0) ts = 0 for t ≤ 10 and p ∈ {2, 3} t =8 (3,0,0) t =9 (5,0), (2,2,0), (2,0,1,0), (2,0,0,0,0) t = 10 (3,1,0), (2,1,0,0) t ,0 −1 ,t ,...,t +1 Corollary 5 Let H = H p1 s , where p prime, ∈ {1, . . . , s − 1}, t +1 = 0 if < s − 1, and σ = o(H ). Let C p (t1 , . . . , ts ) be the chain of equivalences such that H ∈ C p (t1 , . . . , ts ). Then, if t1 = 1 and = s − 1, H = C p (1, ts + − 1)[σ − 1] and |C p (1, ts + − 1)| = ts + σ − 1; otherwise, H = C p (t1 , . . . , ts )[σ ] and |C p (t1 , . . . , ts )| = ts + σ . Proof By Theorem 9, we have three cases. If t1 = 1 and = s − 1, we have that σ = s and −1 H = H pt1 ,0 ,ts = C p (t1 , ts + − 1)[σ − 1]. Then, by Corollary 2, |C p (t1 , ts + − 1)| = ts + − 1 + 1 = ts + s − 1 = ts + σ − 1. If t1 ≥ 2, then σ = 1 and H = H pt1 ,...,ts = C p (t1 , . . . , ts )[1], so by Corollary 2, |C p (t1 , . . . , ts )| = ts + 1 = ts + σ . If t1 = 1 and < s − 1, we have that H = H pt1 ,...,ts = C p (tσ + 1, tσ +1 , . . . , ts−1 , ts + σ − 1)[σ ]. By Corollary 2, |C p (tσ + 1, tσ +1 , . . . , ts−1 , ts + σ − 1)| = ts + σ − 1 + 1 = ts + σ . Example 10 The Z35 -linear GH code H31,0,0,1,2 has t1 = 1, = 3, σ = 4, and s = 5. By Theorem 9, since 3 = < s − 1 = 4, σ = 4, and s = s − σ + 1 = 2, this code is placed in the fourth position of the chain of equivalences C3 (t1 , t2 ), where t1 = t4 + 1 = 1 + 1 = 2 and t2 = t5 + σ − 1 = 2 + 4 − 1 = 5. Therefore, H31,0,0,1,2 = C3 (2, 5)[4]. By Corollary 5, C3 (2, 5) contains exactly t5 + σ = 2 + 4 = 6 codes, which are the ones described in Example 8. If H pt1 ,...,ts is a Z ps -linear GH code of length p t with t1 ≥ 2 and ts = 0, then H pt1 ,...,ts = C p (t1 , . . . , ts )[1] and |C p (t1 , . . . , ts )| = 1 since σ = 1, by Corollary 5. From Tables 1 and 3 given in [11], and Tables 3, 4 and 5, we can see that H pt1 ,...,ts is not equivalent to any other t ,...,t code H p1 s of the same length p t , for t ≤ 11 if p = 2, for t ≤ 10 if p = 3, and for t ≤ 8 if p = 5. We conjecture that this is true in general, for any t ≥ 3 and p prime. The values of (t1 , . . . , ts ) for which the code H pt1 ,...,ts is not equivalent to any other such code of the same length p t , for t ≤ 10 and p ∈ {2, 3}, can be found in Table 6. These values are also the same at least for t ≤ 8 if p = 5 by Table 5. From Tables 3 and 4, we can also see that the Z3s -linear GH codes of length 3t with t ≤ 10 having the same values (r , k) are the ones which are equivalent by Theorem 7. The same happens for Z5s -linear GH codes of length 5t with t ≤ 8 by Table 5, and the same was known for Z2s -linear GH codes of length 2t with t ≤ 11 [12]. We conjecture that this is true in general, for any t ≥ 3 and p prime. 4 Improvement of the partial classification In this section, we improve some results on the classification of the Z ps -linear GH codes of length p t with p ≥ 3 prime, once t is fixed. More precisely, we improve the upper bounds 123 On the equivalence of Zps -linear generalized Hadamard codes of At, p given by Theorem 6 and determine the exact value of At,3 for t ≤ 10 and At,5 for t ≤ 8, by using the equivalence results established in Sect. 3. This represents a generalization of the results given by Theorem 5 for p = 2. Next, we prove two corollaries of Theorem 7, which allow us to improve the known upper bounds on At, p with t ≥ 3 and p ≥ 3 prime. Corollary 6 Let H pt1 ,...,ts be a nonlinear Z ps -linear GH code with p prime, and σ = o(H pt1 ,...,ts ). Then, H pt1 ,...,ts is permutation equivalent to ts + σ Z ps -linear GH codes, for t ,...,ts s ∈ {s + 1 − σ, . . . , s + ts }. Among them, there is exactly one H p1 with t1 ≥ 2, and t ,...,t there is exactly one H p1 s with ts = 0. Proof The code H pt1 ,...,ts belongs to a chain of equivalences C, which can be determined by Theorem 9. We have that H pt1 ,...,ts is equivalent to any code in C by Theorem 7, and the number of codes in C is ts + σ by Corollary 5. By Theorem 9, the first code in C has t ,...,t s = s − σ + 1. By Proposition 4, the i-th code H p1 s = C[i] has s = s − σ + i for i ∈ {1, . . . , ts + σ }. Therefore, s ∈ {s − σ + 1, . . . , s + ts }. Finally, by Corollary 4, C[1] is the only code in C with t1 ≥ 2 and C[ts + σ ] is the only code in C with ts = 0. From Corollary 6, in order to determine the number of nonequivalent nonlinear Z ps -linear GH codes of length p t with p ≥ 3 prime, named At, p , we just have to consider one code out of the ts + σ codes that are permutation equivalent. For example, we can consider the one with t1 ≥ 2. Corollary 7 Let H be a nonlinear Z ps -linear GH code of length p t with p prime. If s ∈ {(t + 1)/2 + 1, . . . , t + 1}, then there is a permutation equivalent Z ps -linear GH code of length p t with s ∈ {2, . . . , (t + 1)/2 }. Proof Let H pt1 ,...,ts be a Z ps -linear GH code with s ∈ {(t + 1)/2 + 1, . . . , t + 1}. Since  s i=1 (s + 1 − i)ti = t + 1 and t1 ≥ 1, then t1 = 1 and we have that σ > 1. There- fore, by Theorem 9, H pt1 ,...,ts is permutation equivalent to the Z ps−σ +1 -linear GH code t +1,t ,...,t ,t +σ −1 H = H pσ σ +1 s−1 s . Now, we just need to see that s − σ +1 < (t + 1)/2 . Since the length of H is p t , we s−σ +1 have that t + 1 = (s − σ + 1)(tσ + 1) + i=2 (s − σ + 2 − i)tσ −1+i + σ − 1. Therefore, (s − σ + 1)(tσ + 1) ≤ t + 1 and s − σ + 1 ≤ (t + 1)/(tσ + 1). By the definition of tσ , we know that tσ ≥ 1, so s − σ + 1 ≤ (t + 1)/2 . Note that we can focus on the Z ps -linear GH codes of length p t with p prime and s ∈ {2, . . . , (t + 1)/2 } by Corollary 7, and we can restrict ourselves to the codes having t1 ≥ 2 by Corollary 6. With this on mind, in order to classify s all such codes for a given t ≥ 3, we define X̃ t,s, p = |{(t1 , . . . , ts ) ∈ Ns : t + 1 = i=1 (s − i + 1)ti , t1 ≥ 2}| for s ∈ {2, . . . , (t s + 1)/2 } if p ≥ 3 prime. Recall that for p = 2, X̃ t,s,2 = |{(t1 , . . . , ts ) ∈ Ns : t + 1 = i=1 (s − i + 1)ti , t1 ≥ 2}| for s ∈ {3, . . . , (t + 1)/2 } and X̃ t,2,2 = |{(t1 , t2 ) ∈ N2 : t + 1 = 2t1 + t2 , t1 ≥ 3}|. Theorem 10 For all t ≥ 3 and p prime,  t+1  2 At, p ≤ 1 + X̃ t,s, p (13) s=2 123 D. K. Bhunia et al. Table 7 Bounds for the number At,3 of nonequivalent Z3s -linear GH codes of length 3t for 3 ≤ t ≤ 10 t 3 4 5 6 7 8 9 10 Previous lower bound (r , k) 2 2 4 4 7 8 12 14 New upper bound (13) 2 2 4 4 7 8 12 14 New upper bound (14) 2 2 5 6 11 15 26 33 Previous upper bounds (7) and (8) 2 2 6 9 15 22 33 46 Table 8 Bounds for the number t 3 4 5 6 7 8 At,5 of nonequivalent Z5s -linear GH codes of length 5t for Previous lower bound (r , k) 2 2 4 4 7 8 3≤t ≤8 New upper bound (13) 2 2 4 4 7 8 New upper bound (14) 2 2 5 6 11 15 Previous upper bounds (7) and (8) 2 2 6 9 15 22 and  t+1  2 At, p ≤ 1 + (At,s, p − 1). (14) s=2 Moreover, for any 3 ≤ t ≤ 11 if p = 2, any 3 ≤ t ≤ 10 if p = 3, and any 3 ≤ t ≤ 8 if p = 5, the upper bound (13) is tight. Proof If p = 2, the result is given by Theorem 5. For p ≥ 3 prime, it is proven that the codes H p1,0,...,0,ts with s ≥ 2 and ts ≥ 0, are the only Z ps -linear GH codes which are linear. Note that they are not included in the definition of X̃ t,s, p for s ∈ {2, . . . , (t + 1)/2 }. Therefore, the new upper bounds (13) and (14) follow by Corollaries 6 and 7, after adding 1 to take into account the linear code. In Table 7, for p = 3 and 3 ≤ t ≤ 10, these new upper bounds together with previous bounds are shown. Note that the lower bound based on the rank and dimension of the kernel coincides with the upper bound (13) for t ≤ 10, so this upper bound is tight for t ≤ 10. Similarly, for p = 5 and 3 ≤ t ≤ 8, the upper bound (13) is tight considering Table 8. This last result improves the partial classification given in [3] or Theorem 6. Actually, by definition, we have that X̃ t,s, p ≤ X t,s, p − 1, so the upper bound (13) is clearly better than (7). It is also clear that the upper bound (14) is better than (8) since there are fewer addends. Therefore, both new upper bounds improve the previous known upper bounds given by Theorem 6. Recall that At,s,3 = X t,s,3 for any 3 ≤ t ≤ 10 and 2 ≤ s ≤ t − 1, and At,s,5 = X t,s,5 for any 3 ≤ t ≤ 8 and 2 ≤ s ≤ t − 1. If this equation is also true for any t ≥ 3 and p ≥ 3 prime, then upper bounds (7) and (8) coincide. Moreover, upper bound (13) would always be better than (14) since X̃ t,s, p ≤ X t,s, p − 1 = At,s, p − 1. 5 Conclusions and further research The aim of this paper is to improve the classification of Z ps -linear GH codes of length p t with p prime, fixing the value of t. This approach complements the classification given in [3, 123 On the equivalence of Zps -linear generalized Hadamard codes 11] in which the authors fix the values of t and s. Specifically, we prove that there are some families of Z ps -linear GH codes of length p t , with codes having different values of s, such that all the codes belonging to the same family are equivalent to each other. This result is a generalization of a similar result given in [12] for p = 2. It allows us to improve the known upper bounds for At, p . Moreover, it can be used to see that we only need to focus on finding the rank of Z ps -linear GH codes H pt1 ,...,ts with t1 ≥ 2 and s ∈ {2, . . . , (t + 1)/2 } in order to establish a full classification, that is, to prove that the upper bound (13) is tight. Taking into account the results about equivalences presented along this paper, we conjec- ture that Z ps -linear GH codes H pt1 ,...,ts with t1 ≥ 2 and ts = 0 are not equivalent to any other Z ps -linear GH code of the same length. We know that this statement is true at least for the codes of length p t with t up to 11, 10, 8 when p is equal to 2, 3, 5, respectively. Acknowledgements The authors would like to thank the anonymous referees for their valuable comments, which enabled them to improve the quality of the paper. Funding Open Access Funding provided by Universitat Autonoma de Barcelona. Data availability No data was used for the research described in the article. 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/. References 1. Assmus E.F., Key J.D.: Designs and Their Codes. Cambridge University Press, Cambridge (1992). 2. Bauer H., Ganter B., Hergert F.: Algebraic techniques for nonlinear codes. Combinatorica 3(1), 21–33 (1983). 3. Bhunia D.K., Fernández-Córdoba C., Villanueva M.: On the linearity and classification of Z ps -linear generalized Hadamard codes. Des. Codes Cryptogr. 90, 1037–1058 (2022). 4. Borges J., Fernández-Córdoba C., Rifà J.: Every Z2k -code is a binary propelinear code. Electron. Notes Discret. Math. 10, 100–102 (2001). 5. Butson A.T.: Generalized Hadamard matrices. Proc. Am. Math. Soc. 13, 894–898 (1962). 6. Bose R.C., Bush K.A.: Orthogonal arrays of strength two and three. Ann. Math. Stat. 23(4), 508–524 (1952). 7. Bosma W., Cannon J.J., Fieker C., Steel A.: Handbook of Magma functions. Edition 2.25 (2020). http:// magma.maths.usyd.edu.au/magma/. 8. Carlet C.: Z2k -linear codes. IEEE Trans. Inf. Theory 44(4), 1543–1547 (1998). 9. Dougherty S.T., Fernández-Córdoba C.: Codes over Z2k , Gray map and self-dual codes. Adv. Math. Commun. 5(4), 571–588 (2011). 10. Dougherty S.T., Rifà J., Villanueva M.: Ranks and kernels of codes from generalized Hadamard matrices. IEEE Trans. Inf. Theory 62(2), 687–694 (2016). 11. Fernández-Córdoba C., Vela C., Villanueva M.: On Z2s -linear Hadamard codes: kernel and partial clas- sification. Des. Codes Cryptogr. 87(2–3), 417–435 (2019). 12. Fernández-Córdoba C., Vela C., Villanueva M.: Equivalences among Z2s -linear Hadamard codes. Discret. Math. 343(3), 111721 (2020). 13. Greferath M., Schmidt S.E.: Gray isometries for finite chain rings and a nonlinear ternary (36, 312 , 15) code. IEEE Trans. Inf. Theory 45(7), 2522–2524 (1999). 14. Hammons A.R., Kumar P.V., Calderbank A.R., Sloane N.J., Solé P.: The Z4 -linearity of Kerdock, Preparata, Goethals, and related codes. IEEE Trans. Inf. Theory 40(2), 301–319 (1994). 123 D. K. Bhunia et al. 15. Jungnickel D.: On difference matrices, resolvable transversal designs and generalized Hadamard matrices. Math. Z. 167(1), 49–60 (1979). 16. Krotov D.S.: Z4 -linear Hadamard and extended perfect codes. Electron. Notes Discret. Math. 6, 107–112 (2001). 17. Krotov D.S.: On Z2k -dual binary codes. IEEE Trans. Inf. Theory 53(4), 1532–1537 (2007). 18. Li X., Shi M., Wang S., Lu H., Zheng Y.: Rank and pairs of rank and dimension of kernel of Z p Z p2 -linear codes. IEEE Trans. Inf. Theory (2023). https://doi.org/10.1109/TIT.2023.3317064. 19. Nechaev A.A., Khonol’d T.: Weighted modules and representations of codes. Problemy Peredachi Infor- matsii 35(3), 18–39 (1999). 20. Phelps K.T., Rifà J., Villanueva M.: Kernels and p-kernels of pr -ary 1-perfect codes. Des. Codes Cryptogr. 37(2), 243–261 (2005). 21. Phelps K.T., Rifà J., Villanueva M.: On the additive (Z4 -linear and non-Z4 -linear) Hadamard codes: rank and kernel. IEEE Trans. Inf. Theory 52(1), 316–319 (2006). 22. Pujol J., Villanueva M.: q-ary codes. A magma package, version 1.0. Universitat Autònoma de Barcelona, Barcelona (2017). https://ccsg.uab.cat/. 23. Semakov N.V., Zinoviev V.A., Zaitsev V.G.: Class of maximal equidistant codes. Probl. Inf. Transm. 4(2), 84–87 (1968). 24. Shi M., Sepasdar Z., Alahmadi A., Solé P.: On two-weight Z2k -codes. Des. Codes Cryptogr. 86(6), 1201–1209 (2018). 25. Shi M., Wu R., Krotov D.S.: On Z p Z pk -additive codes and their duality. IEEE Trans. Inf. Theory 65(6), 3841–3847 (2019). 26. Shi M., Honold T., Solé P., Qiu Y., Wu R., Sepasdar Z.: The geometry of two-weight codes over Z pm . IEEE Trans. Inf. Theory 67(12), 7769–7781 (2021). 27. Villanueva N., Zinoviev V.A., Zinoviev D.V.: On one construction method for Hadamard matrices. Probl. Inf. Transm. 58(4), 13–37 (2022). 28. Zinoviev V.A., Zinoviev D.V.: On the generalized concatenated construction for codes in l1 and lee metrics. Probl. Inf. Transm. 57(1), 81–95 (2021). Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Authors and Affiliations Dipak K. Bhunia1 · Cristina Fernández-Córdoba1 · Carlos Vela2 · Mercè Villanueva1 Cristina Fernández-Córdoba cristina.fernandez@uab.cat Carlos Vela carlos.vela@ua.pt Mercè Villanueva merce.villanueva@uab.cat 1 Department of Information and Communications Engineering, Universitat Autònoma de Barcelona, 08193 Cerdanyola del Vallès, Spain 2 Department of Mathematics, University of Aveiro, 3810-197 Aveiro, Portugal 123