Designs, Codes and Cryptography (2022) 90:1037–1058 https://doi.org/10.1007/s10623-022-01026-2 On the linearity and classification of Zps -linear generalized Hadamard codes Dipak K. Bhunia1 · Cristina Fernández-Córdoba1 · Mercè Villanueva1 Received: 22 August 2021 / Revised: 17 February 2022 / Accepted: 22 February 2022 / Published online: 14 March 2022 © The Author(s) 2022 Abstract Z ps -additive codes of length n are subgroups of Znps , and can be seen as a generalization of linear codes over Z2 , Z4 , or Z2s in general. 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 by a generalized Gray map. In this paper, we generalize some known results for Z ps -linear GH codes with p = 2 to any odd prime p. First, we show some results related to the generalized Carlet’s Gray map. Then, by using an iterative construction of Z ps -additive GH codes of type (n; t1 , . . . , ts ), we show for which types the corresponding Z ps -linear GH codes of length p t are nonlinear over Z p . For these codes, we compute the kernel and its dimension, which allow us to give a partial classification. The obtained results for p ≥ 3 are different from the case with p = 2. Finally, the exact number of non-equivalent such codes is given for an infinite number of values of s, t, and any p ≥ 2; by using also the rank as an invariant in some specific cases. Keywords Hadamard code · Gray map · Z ps -linear code · Z ps -additive code · Kernel · Classification Mathematics Subject Classification 94B25 · 94B60 Communicated by C. Carlet. This work has been partially supported by the Spanish MINECO under Grant PID2019-104664GB-I00 (AEI/ 10.13039/501100011033) and by Catalan AGAUR scholarship 2020 FI SDUR 00475. The material in this paper was presented in part at the 26th International Conference on Applications of Computer Algebra, CACT@ACA2021, 23–27 July 2021-Virtual. B Mercè Villanueva merce.villanueva@uab.cat Dipak K. Bhunia dipak.bhunia@uab.cat Cristina Fernández-Córdoba cristina.fernandez@uab.cat 1 Department of Information and Communications Engineering, Universitat Autònoma de Barcelona, 08193 Cerdanyola del Vallès, Spain 123 1038 D. K. Bhunia et al. 1 Introduction Let Z ps be the ring of integers modulo p s with p prime and s ≥ 1. The set of n-tuples over Z ps is denoted by Znps . 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. A code over Z p of length n is a nonempty subset of Znp , and it is linear if it is a subspace of Znp . Similarly, a nonempty subset of Znps is a Z ps -additive if it is a subgroup of Znps . Note that, 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 . Two codes C1 and C2 over Z p of length n are said to be monomially equivalent (or just equivalent) provided there is a monomial matrix M such that C2 = {cM : c ∈ C1 }. Recall that a monomial matrix is a square matrix with exactly one nonzero entry in each row and column. They are said to be permutation equivalent if there is a permutation matrix P such that C2 = {cP : c ∈ C1 }. Recall that a permutation matrix is a square matrix with exactly one 1 in each row and column and 0s elsewhere. A permutation matrix represents a permutation of coordinates, so we can also say that they are permutation equivalent if there is a permutation of coordinates π such that C2 = {π(c) : c ∈ C1 }. Similarly, two Z ps -additive codes, C1 and C2 , are said to be permutation equivalent if they differ only by a permutation of coordinates, that is, if there is a permutation of coordinates π such that C2 = {π(c) : c ∈ C1 }. In [15], a Gray map from Z4 to Z22 is defined as φ(0) = (0, 0), φ(1) = (0, 1), φ(2) = (1, 1) and φ(3) = (1, 0). There exist different generalizations of this Gray map, which go from s−1 Z2s to Z22 [5, 7, 9, 16, 19]. The one given in [16] can be defined in terms of the elements of a Hadamard  code [19], and Carlet’s  Gray map [7] is a particular case of the one given in [19] satisfying λi φ(2i ) = φ( λi 2i ) [11]. In this paper, we focus on a generalization of p s−1 Carlet’s Gray map, from Z ps to Z p , which is also a particular case of the one given in np s−1 [25]. We define Φ : Znps→ Zp as the component-wise Gray map φ. Let C be a Z ps -additive code of length n. We say that its image C = Φ(C ) is a Z ps -linear code of length p s−1 n. Since C is a subgroup of Znps , it is isomorphic to an abelian structure t ts Ztp1s × Ztp2s−1 × · · · × Z ps−1 2 × Z p , and we say that C , or equivalently C = Φ(C ), is of type (n; t1 , . . . , ts ). Note that |C | = p st1 p (s−1)t2 · · · p ts . Unlike linear codes over finite fields, linear codes over rings do not have a basis, but there exists a generator matrix for these codes having minimum number of rows, that is, t1 + · · · + ts rows. The Hamming weight of a vector u ∈ Znp , denoted by wt H (u), is the number of nonzero coordinates of u. The Hamming distance of two vectors u, v ∈ Znp , denoted by d H (u, v), is the number of coordinates in which they differ. Note that d H (u, v) = wt H (v − u). The minimum distance of a code C over Z p is d(C) = min{d H (u, v) : u, v ∈ C, u  = v}. Two structural properties of codes over Z p are the rank and dimension of the kernel. The rank of a code C over Z p is simply the dimension of the linear span, C, of C. The kernel of a code C over Z p is defined as K(C) = {x ∈ Znp : x + C = C} [3, 20]. 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. We denote the rank of C as rank(C) and the dimension of the kernel as ker(C). These parameters can be used to distinguish between non-equivalent codes, 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 123 On the linearity and classification of Zps -linear... 1039 [17]. An ordinary Hadamard matrix of order 4μ corresponds to a G H matrix H (2, λ) over Z2 , where λ = 2μ [2]. 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 the first row and column of a G H matrix into zeros and we obtain an equivalent G H matrix which is called normalized. From a normalized Hadamard matrix H , we denote  by FH the code over Z p consisting of the rows of H , and C H the one defined as C H = α∈Z p (FH + α1), where FH + α1 = {h + α1 : h ∈ FH } and 1 denotes the all-one vector. The code C H over Z p is called a generalized Hadamard (G H ) code [10]. Note that C H is generally a nonlinear code over Z p . Let C be a Z ps -additive code such that Φ(C ) is a GH code. Then, we say that C is a Z ps - additive GH code and Φ(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 . It is known that the Z4 -linear Hadamard codes of length 2t can be classified by using either the rank or the dimension of the kernel as a complete invariant for determining the equivalence class [18, 21]. There are exactly t−1 2 such codes for all t ≥ 2. Later, in [11], an iterative construction for Z2s -linear Hadamard codes was described, and the linearity and kernel of these codes were established. A partial classification by using the kernel was obtained, and the exact amount of non-equivalent such codes was given up to t = 11 for any s ≥ 2. Linear codes over Z ps were studied by Blake [4] and Shankar [22] in 1975 and 1979, respectively. Nevertheless, the study of codes over rings increased significantly after the publi- cation of some good properties of linear codes over Z4 and the definition of the Gray map [15]. After that, Z2s -additive codes and their images under the Gray map have been deeply studied, for example, in [7], and later in [26] and [14]. In [19], Krotov studied Z2s -linear Hadamard codes and their dual codes by using different generalizations of the Gray map. In [23, 24], considering Carlet’s generalization of the Gray map, two-weight Z ps -linear and Z2s -linear codes are studied. Note that Z ps -linear Hadamard codes are in fact a particular case of these two-weight codes. More recently, Z ps -linear GH codes have been constructed in [1] as images under the Gray map of Butson Hadamard codes, defined from Butson Hadamard matrices. This paper is focused on Z ps -linear GH codes of length p t , for any t ≥ 3, s ≥ 2 and p an odd prime. We generalize some results related to the linearity, kernel and classification of such codes, that are given for p = 2 in [11]. This paper is organized as follows. In Sect. 2, we recall the definitions of different Gray maps for elements of Z ps , and we establish some properties for the one considered in this paper, called Carlet’s Gray map. In Sect. 3, we describe the construction of Z ps -linear GH codes of type (n; t1 , . . . , ts ) when this Gray map is used. In Sects. 4 and 5, we establish for which types these codes are linear, and we give the kernel and its dimension whenever they are nonlinear. In Sect. 6, we show that, in general, the dimension of the kernel is not enough to classify completely Z ps -linear GH codes. However, for an infinite number of values of t and s, we can obtain a full classification and give the exact amount of non-equivalent such codes. It is worth to mention that the obtained results for p ≥ 3 are different from the binary case. Moreover, new classification results are given also for p = 2. Finally, in Sect. 7, we give some conclusions and further research on this topic. 2 Generalized gray map and some properties In this section, first we give the definition of some Gray maps for elements of Z ps , and then we establish some properties for the one considered in this paper. 123 1040 D. K. Bhunia et al. The usual Gray map from Z4 to Z22 , given in [15], has been generalized to a Gray map s−1 from Z2s to Z22 in [7, 19]. Actually, Carlet’s Gray map  from [7] is a particular case of the Gray map given in [19] satisfying λi φ(2i ) = φ( λi 2i ) [11]. Similarly, in [25], a p s−1 generalized Gray map from Z ps to Z p , with p prime, is defined as follows. Let P be the linear code over Z p generated by a matrix A of size s × p s−1 as follows:   1 A= , (1) Y where the columns of the matrix Y are all different vectors in Zs−1 p . It is easy to check that P is a linear two-weight code of size p s with nonzero weights ( p − 1) p s−2 and p s−1 . Indeed, it is a linear G H code over Z p , and the corresponding GH matrix H ( p, p s−2 ) is known as the Sylvester Hadamard matrix. Note that P is also known as the 1st order generalized Reed-Muller code [2]. Whether the results hold or not is independent of the choice of Y . We arrange the codewords in P = {c0 , c1 , . . . , c ps −1 } in such a way that c0 = 0 and for all u, 0 ≤ u ≤ p s−1 − 1, and j, 0 ≤ j ≤ p − 1, we have that cu+ j ps−1 − cu = ( j, j, . . . , j). Then, the Gray map φ is defined as p s−1 φ : Z ps −→ Z p (2) u −→ cu .   111 Example 1 Let p = 3 and s = 2. For example, we can take A = and P = {c0 = 012 (0, 0, 0), c1 = (0, 1, 2), c2 = (0, 2, 1), c3 = (1, 1, 1), c4 = (1, 2, 0), c5 = (1, 0, 2), c6 = (2, 2, 2), c7 = (2, 0, 1), c8 = (2, 1, 0)}. Then, the Gray map defined by (2) is φ(u) = cu for all u ∈ Z32 . s−1 p s−1 Carlet’s Gray map from Z2s to Z22 [7] can be generalized to a map from Z ps to Z p as follows [13]: φ(u) = (u s−1 , u s−1 , . . . , u s−1 ) + (u 0 , . . . , u s−2 )Y , (3) s−1 where u ∈ Z ps ; [u 0 , u 1 , . . . , u s−1 ] p is the p-ary expansion of u, that is, u = i=0 u i pi with u i ∈ Z p ; and Y is the same matrix as in (1), that is, a matrix of size (s − 1) × p s−1 whose columns are all the vectors in Zs−1 p . The Gray map defined by (3) is a particular case of the one defined by (2), when we consider P = {c0 , c1 , . . . , c ps −1 }, with cu = φ(u) for all 1 ≤ u ≤ p s − 1. In fact, since the p-ary expansion of u, 1 ≤ u ≤ p s−1 − 1, is [u 0 , u 1 , . . . , u s−2 , 0] p , the p-ary expansion of u + j p s−1 is [u 0 , u 1 , . . . , u s−2 , j] p and we have that cu+ j ps−1 − cu = ( j, j, . . . , j). From now on, throughout the paper, we only consider this particular generalization of the Gray np s−1 map. We define Φ : Znps → Z p as the component-wise extended map of φ. Example 2 Let p = 3 and s = 2. Consider Y = (0 1 2) as in Example 1. Table 1 shows the Gray map φ for the elements of Z32 , defined by using (3). Note that this Gray map coincides with the one given in Example 1. However, if in Example 1 we consider another order of the elements of P such that c1  = (0, 1, 2) or c2  = (0, 2, 1), then both Gray maps would be different. Lemma 1 Let u ∈ Z ps and λ ∈ Z p . Then, φ(u + λ p s−1 ) = φ(u) + (λ, λ, . . . , λ). 123 On the linearity and classification of Zps -linear... 1041 Table 1 Gray map for Z32 by u ∈ Z32 [u 0 , u 1 ]3 φ(u) = (u 1 , u 1 , u 1 ) + u 0 Y ∈ Z33 using (3) 0 [0, 0]3 (0, 0, 0) 1 [1, 0]3 (0, 1, 2) 2 [2, 0]3 (0, 2, 1) 3 [0, 1]3 (1, 1, 1) 4 [1, 1]3 (1, 2, 0) 5 [2, 1]3 (1, 0, 2) 6 [0, 2]3 (2, 2, 2) 7 [1, 2]3 (2, 0, 1) 8 [2, 2]3 (2, 1, 0) Proof Note that u + λ p s−1 = u 1 + λ0 p s−1 + λ p s−1 = u 1 + (λ0 + λ) p s−1 , where u 1 ∈ {0, . . . , p s−1 − 1} and λ0 ∈ Z p . Then, by the definition of φ, φ(u + λ p s−1 ) = φ(u 1 ) + (λ0 + λ, . . . , λ0 + λ) = φ(u 1 ) + (λ0 , . . . , λ0 ) + (λ, . . . , λ) = φ(u) + (λ, . . . , λ). Corollary 1 Let λ, μ ∈ Z p . Then, φ(λμ p s−1 ) = λφ(μ p s−1 ) = λμφ( p s−1 ). Proof By the definition of φ, we have that φ(μ p s−1 ) = (μ, . . . , μ). Then, φ(λμ p s−1 ) = (λμ, . . . , λμ) = λ(μ, . . . , μ) = λφ(μ p s−1 ) = λμφ( p s−1 ). Let u, v ∈ Z ps and [u 0 , u 1 , . . . , u s−1 ] p , [v0 , v1 , . . . , vs−1 ] p be the p-ary expansions of s−1 s−1 u and v, respectively, i.e. u = i=0 u i pi and v = i=0 vi pi . We define two operations s−1 “⊕ p ” and “ p ” between elements in Z ps as u ⊕ p v = i=0 ri pi , where u i + vi = ri in s−1 i Z p , and u  p v = i=0 ti p , where  1 if u i + vi ≥ p, ti = 0 otherwise. Note that the p-ary expansion of u ⊕ p v is [r0 , r1 , . . . , rs−1 ] p = [u 0 +v0 , . . . , u s−1 +vs−1 ] p and the p-ary expansion of u  p v is [t0 , t1 , . . . , ts−1 ] p , where ti ∈ {0, 1}. We denote in the same way, “⊕ p ” and “ p ”, the component-wise operation. Proposition 1 Let u, v ∈ Z ps . Then, φ(u) + φ(v) = φ(u ⊕ p v). Proof Let [u 0 , u 1 , . . . , u s−1 ] p , [v0 , v1 , . . . , vs−1 ] p be the p-ary expansions of u and v, respectively. Let yi be the s−2(i + 1)-th row of Y , 0 ≤ i ≤ s − 2. Then,φ(u) = s−2 (u s−1 , u s−1 , . . . , u s−1 ) + i=0 u i yi and φ(v) = (vs−1 , vs−1 , . . . , vs−1 ) + i=0 vi yi . s−2 Therefore, φ(u) + φ(v) = (rs−1 , rs−1 , . . . , rs−1 ) + i=0 ri yi = φ(u ⊕ p v), where ri = u i + vi in Z p for 0 ≤ i ≤ s − 1. Proposition 2 Let u, v ∈ Z ps . Then, u ⊕ p v = u + v − p(u  p v). Proof Let [u 0 , u 1 , . . . , u s−1 ] p , [v0 , v1 , . . . , vs−1 ] p be the p-ary expansions of u and v, respectively. Note that 0 ≤ u i + vi ≤ 2 p − 2. By the division algorithm for integers, we can write u i + vi = pti + ri , where ti is  1 if u i + vi ≥ p and  it is 0 otherwise, and s−1 s−1 0 ≤ ri ≤ p − 1. Then, we have u + v = i=0 i(u + vi ) p i = i=0 ( pti + ri ) p = i s−1 i s−1 p i=0 ti p + i=0 ri pi = p(u  p v) + u ⊕ p v. Therefore, u ⊕ p v = u + v − p(u  p v). 123 1042 D. K. Bhunia et al. Corollary 2 Let u, v ∈ Z ps . Then, φ(u) + φ(v) = φ(u + v − p(u  p v)). Proof The result follows from Proposition 1 and Proposition 2. Corollary 3 Let u, v ∈ Z ps . Then, p s−1 u ⊕ p v = p s−1 u + v. Proof Let [u 0 , u 1 , . . . , u s−1 ] p , [v0 , v1 , . . . , vs−1 ] p be the p-ary expansions of u and v, respectively. We have that [0, . . . , 0, u 0 ] p is the p-ary expansion of p s−1 u, so p s−1 u  p v is p s−1 if u 0 + vs−1 ≥ p and it is 0 otherwise. In any case, p( p s−1 u  p v) = 0. Hence, the result follows from Proposition 2. Corollary 4 Let u ∈ Z ps and [u 0 , u 1 , . . . , u s−1 ] p its p-ary expansion. Then, for any i ∈ {0, . . . , s − 1}, φ(u) + φ( pi ) = φ(u + pi − pi+1 ti ), where  1 if u i = p − 1, ti = 0 otherwise. Corollary 5 Let u, v ∈ Z ps . Then, φ( p s−1 u + v) = φ( p s−1 u) + φ(v). Proof The result follows from Proposition 1 and Corollary 3. Note that Lemma 1 and Corollary 1 are true for any Gray map φ defined by (2). However, Proposition 1 is only true if we consider the one defined by (3). For example, if φ(1) = (1, 0, 2) and φ(2) = (1, 2, 0), then φ(2) + φ(4) = φ(2) + φ(1 + 3) = φ(2) + φ(1) + (1, 1, 1) = (0, 0, 0), but φ(2 ⊕ p 4) = φ(3) = (1, 1, 1). From [8], the homogeneous weight of an element u ∈ Z ps is defined by ⎧ ⎨0 if u = 0, wt ∗ (u) = p s−1 if u ∈ p s−1 Z ps \ {0}, (4) ⎩ ( p − 1) p s−2 otherwise, and the corresponding homogeneous distance of u = (u 1 , u 2 , . . . , u n ) and v = (v1 , v2 , . . . , vn ) ∈ Znps is defined as follows: d ∗ (u, v) = n ∗ i=1 wt (u i − vi ). Note that Carlet’s Gray map is an isometry which transforms homogeneous distances defined in Znps np s−1 to Hamming distances defined in Z p . Proposition 3 Let u, v ∈ Z ps be two distinct elements. Then, φ(u) − φ(v) = φ(u − v) = (λ, . . . , λ) if u − v = λ p s−1 ∈ p s−1 Z ps \ {0}, and φ(u) − φ(v) contains every element of Z p exactly p s−2 times if u − v ∈ Z ps \ p s−1 Z ps . Proof First, if u − v = λ p s−1 ∈ p s−1 Z ps \ {0}, then by Lemma 1, φ(u) = φ(v) + (λ, . . . , λ) with λ  = 0. So, φ(u) − φ(v) = (λ, . . . , λ) = φ(λ p s−1 ) = φ(u − v). Assume now that u − v ∈ Z ps \ p s−1 Z ps . Then, without loss of generality, either u ∈ p s−1 Z ps , v ∈ Z ps \ p s−1 Z ps or u, v ∈ Z ps \ p s−1 Z ps . For the first case, φ(u) = (λ1 , . . . , λ1 ) and φ(v) = φ(v1 ) + (λ2 , . . . , λ2 ), where v1 ∈ {1, 2, . . . , p s−1 − 1} and λ1 , λ2 ∈ Z p . Note that φ(v1 ) is a nonzero row of the GH matrix H ( p, p s−2 ) corresponding to the GH code φ(Z ps ). Therefore, φ(v1 ) contains every element of Z p exactly p s−2 times and hence φ(u) − φ(v) contains every element of Z p exactly p s−2 times. For the second case, φ(u) = φ(u 1 )+(λ1 , . . . , λ1 ) and φ(v) = φ(v1 )+(λ2 , . . . , λ2 ), where u 1 , v1 ∈ {1, 2, . . . , p s−1 −1} and λ1 , λ2 ∈ Z p . Again, note that both φ(u 1 ) and φ(v1 ) are nonzero rows of H ( p, p s−2 ), so they contain every element of Z p exactly p s−2 times. Thus, in this case, φ(u) − φ(v) contains every element of Z p exactly p s−2 times. 123 On the linearity and classification of Zps -linear... 1043 Proposition 4 Let u, v ∈ Z ps . Then, d H (φ(u), φ(v)) = wt H (φ(u − v)). Proof If u = 0 or v = 0, the result is trivially true. We assume that u  = 0 and v  = 0, and we consider three cases. First, if u = v, the result is true trivially. Second, if u−v ∈ p s−1 Z ps \{0}, then by Proposition 3, φ(u)−φ(v) = φ(u−v), and hence d H (φ(u), φ(v)) = wt H (φ(u−v)). Finally, assume that u − v ∈ Z ps \ p s−1 Z ps . Again, by Proposition 3, φ(u) − φ(v) contains every element of Z p exactly p s−2 times, and hence d H (φ(u), φ(v)) = ( p − 1) p s−2 = wt H (φ(u − v)). 3 Construction of Zps -additive GH codes The description of generator matrices having minimum number of rows for Z4 -additive Hadamard codes, and an iterative construction of these matrices, are given in [18]. In [19], Z2s -additive Hadamard codes are defined for s > 2, and an iterative construction is given in [11]. In this section, we generalize these results for Z ps -additive GH codes with s ≥ 2 and p an odd prime. Specifically, we define an iterative construction for the generator matrices and establish that they generate Z ps -additive GH codes, as in [11] for p = 2. The generalization of the construction is quite straightforward, but the proof that the codes are GH is different from the binary case. This result has also been obtained independently in [1] by using another approach and considering Butson Hadamard matrices. 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 non-negative 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 . We write At1 ,...,ts instead of Atp1 ,...,ts when the value of p is clear by the context. Let 0, 1, 2, . . . , ps − 1 be the vectors having the elements 0, 1, 2, . . . , p s − 1 from Z ps repeated in each coordinate, respectively. Example 3 For p = 3 and s = 3, we have the following matrices:     11 1 1111 1 1 1 1 1 A1,0,1 = , A1,1,0 = , 0 9 18 0 3 6 9 12 15 18 21 24   1111111111 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 A2,0,0 = , 0 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 ⎛ ⎞ 1111 1 1 1 1 1 1111 1 1 1 1 1 1 1 1 1 1 1 1 1 1 A1,1,1 = ⎝ 0 3 6 9 12 15 18 21 24 0 3 6 9 12 15 18 21 24 0 3 6 9 12 15 18 21 24 ⎠ , 0000 0 0 0 0 0 9999 9 9 9 9 9 18 18 18 18 18 18 18 18 18  2,0,0 2,0,0 2,0,0  A A A A2,0,1 = , 0 9 18  2,0,0 2,0,0 2,0,0 2,0,0 2,0,0 2,0,0  A A A A A A A2,0,0 A2,0,0 A2,0,0 A2,1,0 = . 0 3 6 9 12 15 18 21 24 Any matrix At1 ,...,ts can be obtained by applying the following iterative construction. We start with A1,0,...,0 = (1). Then, if we have a matrix A = At1 ,...,ts , for any i ∈ {1, . . . , s}, we may construct the matrix   A A ··· A Ai = . (5) 0 · pi−1 1 · pi−1 · · · ( p s−i+1 − 1) · pi−1 123 1044 D. K. Bhunia et al.   Finally, permuting the rows of Ai , we obtain a matrix At1 ,...,ts , where t j = t j for j  = i and   ti = ti + 1. Note that any permutation of columns of Ai gives also a matrix At1 ,...,ts . Example 4 Let p = 3 and s = 3 as in Example 3. From the matrix A1,0,0 = (1), we obtain the matrix A2,0,0 ; and from A2,0,0 we can construct A2,0,1 , where A2,0,0 and A2,0,1 are the matrices given in Example 3. Note that we 2,0,1 as follows:  can  also generate another matrix A 1 from A1,0,0 = (1), we obtain A1,0,1 = , where k = (0, 9, 18), given in Example 3; and k from A1,0,1 , we can construct the matrix ⎛ ⎞ 1 1 1 1 ··· 1 1 A1 = ⎝ k k k k · · · k k ⎠ . 0 1 2 3 · · · 25 26 Then, after permuting the rows of A1 , we have a matrix ⎛ ⎞ 1 1 1 1 ··· 1 1 A2,0,1 = ⎝ 0 1 2 3 · · · 25 26 ⎠ , k k k k ··· k k which is different to the matrix A2,0,1 of Example 3. These two matrices A2,0,1 generate permutation equivalent codes. In this paper, we consider that the matrices At1 ,t2 ,...,ts are constructed recursively starting from A1,0,...,0 in the following way. First, we add t1 − 1 rows of order p s , in order to obtain At1 ,0,...,0 ; then t2 rows of order p s−1 to generate At1 ,t2 ,0,...,0 ; and so on, until we add ts rows of order p to achieve At1 ,t2 ,...,ts . Let Ht1 ,...,ts be the Z ps -additive code generateds by the matrix A t1 ,...,ts , where t , . . . , t ≥ 0 1 s with t1 ≥ 1. Let n = p t−s+1 , where t = i=1 (s − i + 1) · ti − 1. It is easy to see that Ht1 ,...,ts is of length n and has |Ht1 ,...,ts | = p s n = p t+1 codewords. Note that this code is of type (n; t1 , t2 , . . . , ts ). Let H t1 ,...,ts = Φ(Ht1 ,...,ts ) be the corresponding Z ps -linear code. Example 5 For p = 3 and λ = 1, we consider the following normalized GH matrix: ⎛ ⎞ 000 H (3, 1) = ⎝0 1 2⎠ . 021  Then, FH = {(0, 0, 0), (0, 1, 2), (0, 2, 1)} and C H = α∈Z3 (FH + α1), which coincides with the code P given in Example 1. Note that C H is a linear GH code over Z3 of length 3, and C H = H 1,0 = Φ(H1,0 ) = Φ(Z9 ), where H1,0 is generated by A1,0 = (1). More generally, we can consider the normalized GH matrix H ( p, 1) given by the multiplicative table over Z p . Then, the corresponding GH code over Z p is C H = H 1,0 = Φ(H1,0 ) = Φ(Z p2 ), which is linear. Example 6 The code H1,0,...,0 is generated by A1,0,...,0 = (1), so H1,0,...,0 = Z ps . This linear code over Z ps has length n = 1 and cardinality p s . Thus, the code H 1,0,...,0 = Φ(H1,0,...,0 ) over Z p has length N = p s−1 and cardinality p s = N p. Actually, H 1,0,...,0 = Φ(Z ps ) is the linear GH code over Z p of length p s−1 used to define the Gray map Φ, so it is generated by (1). The result given by Theorem 1 is already proved in [19] and [11] for p = 2. In [19], it is shown that each Z2s -linear Hadamard code is equivalent to H t1 ,...,ts for some t1 , . . . , ts ≥ 0 123 On the linearity and classification of Zps -linear... 1045 with t1 ≥ 1, considering a generalized Gray map that includes the one given by Carlet. In [11], another technique is used to obtain that the Z2s -linear codes H t1 ,...,ts are Hadamard. For p ≥ 3 prime, the result is already proved in [1]. However, we include another proof which is different, and it is not a generalization of the ones given in [19] and [11] neither. Let G be a generator matrix of a Z ps -additive code C of length n. Then, (G · · · G ) is a generator matrix of the r -fold replication code of C , (C , . . . , C ) = {(c, . . . , c) : c ∈ C }, of length r · n. Theorem 1 Let t1 , . . . , ts be non-negative integers with t1 ≥ 1. The Z p s -linear code H t1 ,...,ts s of type (n; t1 , . . . , ts ) is a GH code over Z p of length N = p , with t = ( i=1 t (s−i +1)·ti )−1 and n = p t−s+1 . Proof Let H = Ht1 ,...,ts be the Z ps -additive code of length n generated by the matrix A = At1 ,...,ts . We can write H = ∪λ∈Z p (AH + λ · ps−1 ), where AH = {h (mod p s−1 ) : h ∈ H} and AH + λ · ps−1 = {h + λ · ps−1 : h ∈ AH } for any λ ∈ Z p . Then, by Lemma 1, H = Φ(H) = ∪λ∈Z p (Φ(AH ) + λ · 1). The code H has length p t = np s−1 and cardinality p t+1 = np s . Then, it is enough to proof that Φ(AH ) corresponds to the rows of a GH matrix H ( p, p s−2 n). We take two distinct elements u, v from AH . Now, we have to show that Φ(u) − Φ(v) contains every element of Z p exactly p s−2 n times. We consider two cases depending on the order of u − v. First, if o(u − v) = p, then, by construction, u − v contains every element of p s−1 Z ps exactly n/ p times. Thus, Φ(u − v) contains every element of Z p exactly p s−1 n/ p = p s−2 n times. By Proposition 3, Φ(u−v) = Φ(u) − Φ(v) and hence Φ(u) − Φ(v) contains every element of Z p exactly p s−2 n times. Second, if o(u − v) > p, then by construction, u − v contains every element of p s−1 Z ps exactly α times, α ≥ 0, and the remaining n − pα coordinates are from Z ps \ p s−1 Z ps . So, by Proposition 3, Φ(u) − Φ(v) contains every element of Z p exactly α p s−1 + (n − pα) p s−2 = p s−2 n times. Example 7 Let H2,0,0 be the Z27 -additive code generated by A2,0,0 given in Example 3. The Z27 -linear code H 2,0,0 = Φ(H2,0,0 ) has length N = 27 · 9 = 35 , pN = 36 codewords and minimum (Hamming) distance N ( p − 1)/ p = 162. Therefore, it is a Z27 -linear GH code. 4 Linearity of Zps -linear GH codes As shown in [18, 21], the codes H21,t2 and H22,t2 , t2 ≥ 0, are the only Z4 -linear Hadamard codes which are linear. In [14], it is proved that the codes H21,0,...,0,ts , ts ≥ 0, are linear. Indeed, in [11], it is shown that for s > 2 the codes H21,0,...,0,1,ts and H21,0,...,0,ts , ts ≥ 0, are the only Z2s -linear Hadamard codes which are linear. The next result shows that for any p ≥ 3 prime, s ≥ 2 and ts ≥ 0, H p1,0,...,0,ts are the only Z ps -linear GH codes which are linear. Note that this result for p ≥ 3 does not coincide with the case p = 2. Theorem 2 The Z ps -linear GH codes H 1,0,...,0,ts , with p ≥ 3 prime, s ≥ 2 and ts ≥ 0, are linear. Proof We prove that these codes are linear by induction on ts . By Example 6, H 1,0,...,0 is linear. Assume, H = Φ(H), where H = H1,0,...,0,ts , s ≥ 2 and ts ≥ 0, is linear. Now, we 123 1046 D. K. Bhunia et al. have to show that Hs = H 1,0,...,0,ts +1 is linear. By the iterative construction, Hs = {Φ((h, h, . . . , h) + λ(0, ps−1 , 2ps−1 , . . . , ( p − 1)ps−1 ) : h ∈ H, λ ∈ Z p } = {(Φ(h), Φ(h + λps−1 ), Φ(h + λ2ps−1 ), . . . , Φ(h + λ( p − 1)ps−1 )) : h ∈ H, λ ∈ Z p }, and, by Corollaries 5 and 1, it is equal to {(Φ(h), Φ(h) + λΦ(ps−1 ), Φ(h) + λΦ(2ps−1 ), . . . , Φ(h) + λΦ(( p − 1)ps−1 )) : h ∈ H, λ ∈ Z p } = {(h , h + λ · 1, h + λ · 2, . . . , h + λ · (p − 1)) : h ∈ H , λ ∈ Z p }. Thus, we can partition Hs into p-blocks, Hs0 , Hs1 , Hs2 , . . . , Hs( p−1) , where Hs0 = {(h , h , . . . , h ) : h ∈ H }, Hs1 = {(h , h + 1, h + 2, . . . , h + (p − 1)) : h ∈ H }, Hs2 = {(h , h + 2, h + 4, . . . , h + 2(p − 1)) : h ∈ H }, .... Hs( p−1) = {(h , h + (p − 1), h + 2(p − 1), . . . , h + 1)) : h ∈ H }. Since H is linear, it is clear that if we take any two vectors from Hs , then their addition belongs to any one of the blocks Hs0 , Hs1 , Hs2 , · · · , Hs( p−1) . Therefore, Hs is linear. Theorem 3 The Z ps -linear GH codes H 1,0,...,0,ts , with p ≥ 3 prime, s ≥ 2 and ts ≥ 0, are the only Z ps -linear GH codes which are linear. Proof By Theorem 2, we have that the codes H 1,0,...,0,ts are linear. Let H = Φ(H), where H = Ht1 ,...,ts . For any i ∈ {1, . . . , s}, we define Hi = Φ(Hi ),   where Hi = Ht1 ,...,ts , ti = ti + 1 and t j = t j for j  = i. We consider that H = Φ(H), where H = H1,0,...,0 . Now, we prove that Hi is nonlinear for any i ∈ {1, . . . , s − 1}. Note that the generator matrix of Hi has two rows: w1 = 1 and w2 = pi−1 (0, 1, . . . , p s+1−i − 1). Let w2 j be the j-th coordinate of w2 and [(w2 j )0 , (w2 j )1 , . . . , (w2 j )s−1 ] p its p-ary expansion. By Corollary 4, φ(w2 j ) + φ( pi−1 ) = φ(w2 j + pi−1 − z j ), where z j = pi if (w2 j )i−1 = p − 1, and 0 otherwise. Note that w2 j = pi−1 ( j − 1), so (w2 j )i−1 = p − 1 if and only if j ∈ { p, 2 p, . . . , p s+1−i }. Then, Φ(w2 ) + Φ(pi−1 ) = Φ(w2 + pi−1 − z), p s+1−i where z = (z 1 , z 2 , . . . , z ps+1−i ) ∈ Z ps , z j = pi for j ∈ { p, 2 p, . . . , p s+1−i } and z j = 0 otherwise. Therefore, we just need to show that z ∈ / Hi . Note that wt H (Φ(z)) = p s−i ·wt H (φ( pi )). If i = s−1, then wt H (Φ(z)) = p· p s−1 = p s . If i ∈ {1, . . . , s −2}, then wt H (Φ(z)) = p s−i ·( p −1) p s−2 = p 2s−i−2 ( p −1). However, the minimum distance of Hi is p s−2 ( p − 1) p s+1−i = p 2s−i−1 ( p − 1). Therefore, Φ(z) ∈ / Hi , for i ∈ {1, . . . , s − 1}. Finally, in general, for H = Φ(H), where H = Ht1 ,...,ts , we prove that if H is nonlinear, then Hi is nonlinear for any i ∈ {1, . . . , s}. Assume that Hi is linear. Then, by the iterative construction (5), for any u, v ∈ H, we have that (u, . . . , u), (v, . . . , v) ∈ Hi . Moreover, since Hi is linear, Φ((u, . . . , u)) + Φ((v, . . . , v)) = Φ((a, . . . , a) + λ · pi−1 (0, 1, . . . , p s−i+1 − 1)) ∈ Hi , where a ∈ H and λ ∈ Z ps . Therefore, Φ(u) + Φ(v) = Φ(a) ∈ H , and we have that H is linear and the result follows. Example 8 Considering all non-negative integer solutions with t1 ≥ 1 of the equation 4 = 3t1 + 2t2 + t3 − 1, we have that the Z p3 -linear GH codes of length p 4 are the following: H p1,0,2 and H p1,1,0 . By Theorem 3, we have that H p1,0,2 is linear, so ker(H p1,0,2 ) = 5. By the same theorem, we also have that H p1,1,0 is nonlinear, so ker(H p1,1,0 ) = 3 < 5. 123 On the linearity and classification of Zps -linear... 1047 Example 9 Considering all non-negative integer solutions with t1 ≥ 1 of the equation 5 = 3t1 +2t2 +t3 −1, we have that the Z p3 -linear GH codes of length p 5 are the following: H p1,0,3 , H p1,1,1 and H p2,0,0 . By Theorem 3, we have that H p1,0,3 is linear, so ker(H p1,0,3 ) = 6. By the same theorem, we also have that H p1,1,1 and H p2,0,0 are nonlinear, so ker(H p1,1,1 ) = 4 < 6 and ker(H p2,0,0 ) = 2 < 6. 5 Kernel of Zps -linear GH codes For Z4 -linear Hadamard codes and Z2s -linear Hadamard codes with s > 2, the kernel and its dimension are given in [18, 21] and [11], respectively. In this section, we generalize these results for Z ps -linear GH codes with p ≥ 3 prime and s ≥ 2. First, we establish a lower bound on the dimension of the kernel, and then we construct a basis of the kernel and give its exact dimension. We see that all the basis vectors of the kernel for p ≥ 3 are the generalized s−2 i forms of the nonlinear ones for p = 2 except Φ( i=0 p ), which does not belong to the kernel, and so the dimension of the kernel is decreased by one for p ≥ 3 prime. Let At1 ,...,ts be the generator matrix of Ht1 ,...,ts , and let wi be the i-th row vector of At1 ,...,ts . By construction, w1 = 1 and o(wi ) ≤ o(w j ) if i > j. We define σ ∈ {1, . . . , s} as the integer such that o(w2 ) = p s+1−σ . For H1,0,...,0 , we define σ = s. Note that σ = 1 if t1 > 1, and σ = min{i : ti > 0, i ∈ {2, . . . , s}} if t1 = 1. In the case σ = s, the code is H1,0,...,0,ts , which is linear. Let u = (u 1 , . . . , u n ) ∈ Znps and [u j,0 , u j,1 , . . . , u j,s−1 ] p be the p-ary expansion of u j , where j ∈ {1, . . . , n}. Let i be an integer such that i ∈ {0, . . . , s − 1}. Then, we denote by u(i) the vector having in the j-th coordinate the i-th element of the p-ary expansion of u j , that is, u(i) = (u 1,i , . . . , u n,i ) ∈ Znp . Proposition 5 Let H = Ht1 ,...,ts be the Z ps -additive GH code of type (n; t1 , . . . , ts ) with p ≥ 3 prime. Let H p be the subcode of H which contains all the codewords of order p. Let M = {pm }σm=0 −2 if σ ≥ 2, and M = ∅ if σ = 1. Then,   Φ(H p ), Φ(M) ⊆ K (Φ(H)) s and ker(Φ(H)) ≥ ( i=1 ti ) + σ − 1. s Proof Let H = Φ(H) and τ = i=1 ti . Let Q = {(o(wk )/ p)wk }τk=1 . Since H p contains all the elements of H of order p, we have that the set Φ(Q) is a basis for the linear subcode H p = Φ(H p ) of H over Z p . By Corollary 5, for all b ∈ H p and u ∈ H, we have that Φ(b) + Φ(u) = Φ(b + u) ∈ H and, therefore, H p ⊆ K (H ). Assume σ ≥ 2. Now, we prove that Φ(pm ) ∈ K (H ) for all m ∈ {0, . . . , σ − 2}. Equivalently, we show that Φ(pm ) + Φ(u) ∈ H for all u ∈ H. If u ∈ H, then u = λ · 1 + u , where λ ∈ Z ps and o(u ) ≤ o(w2 ) = p s+1−σ . Let u = (u 1 , . . . , u n ) ∈ Znps and [u j,0 , u j,1 , . . . , u j,s−1 ] p be the p-ary expansion of u j , j ∈ {1, . . . , n}. Let [λ0 , λ1 , . . . , λs−1 ] p be the p-ary expansion of λ ∈ Z ps . Note that if v ∈ Z ps is of order pi , then its p-ary expansion is of the form [0, . . . , 0, vs−i , vs−i+1 , . . . , vs−1 ] p . Since m ∈ {0, . . . , σ − 2} and o(u ) ≤ p s+1−σ , we have that u(m) = (u 1,m , . . . , u n,m ) = (λm , . . . , λm ). By Corollary 4, we have that Φ(pm ) + Φ(u) = Φ(pm + u − p m+1 tm ), where tm = 1 or tm = 0 depending on whether λm = p − 1 or not, respectively. Therefore, p m+1 tm is 0 or pm+1 . In both cases, p m+1 tm ∈ H, so Φ(pm ) + Φ(u) = Φ(pm + u − p m+1 tm ) ∈ H . Finally, we have to see that the elements of the set {Φ(Q), Φ(M)} are linearly independent. Clearly, the elements of Φ(Q), and also the elements of Φ(M), are linearly independent. By 123 1048 D. K. Bhunia et al. construction, the generator matrix At1 ,...,ts is a block upper triangular matrix, so it is easy to see that the codewords of Φ(Q) are linearly independent of the ones of Φ(M). Therefore, we have that the dimension of the linear span of this set is τ + σ − 1, so ker(H ) ≥ τ + σ − 1. s−1 Lemma 2 Let v, λ ∈ Z ps . Then, v  p λ = i=0 (v  p λi pi ), where [λ0 , λ1 , . . . , λs−1 ] p is the p-ary expansion of λ. Proof Let v ∈ Z ps and let [v0 , v1 , . . . , vs−1 ] p be its p-ary expansion. By definition, we have s−1 s−1 i that v  p λ = v  p i=0 λi pi = i=0 ti p , where ti is 1 if vi + λi ≥ p, and 0 otherwise. s−1 s−1 Note that ti pi = v  p λi pi , so v  p i=0 λi pi = i=0 (v  p λi pi ). Lemma 3 Let H = Ht1 ,...,ts be the Z ps -additive GH code of type (n; t1 , . . . , ts ) with p ≥ 3 s−2 prime. Let N = { i=σ −1 λi p : λi ∈ Z p } if σ ≤ s − 1, and N = {0}, otherwise. Then, i Φ(N ) ∩ K (Φ(H)) = {0}. s−2 Proof Let H = Φ(H). Assume σ ≤ s − 1 and let u = i=σ −1 λi p ∈ N such that i Φ(u) ∈ K (H ). We want to prove that u = 0. Assume that there exists u  = 0, so there exists i 0 ∈ {σ − 1, . . . , s − 2} such that λi0  = 0. By construction, the second row w2 of At1 ,...,ts is a p t−2s+σ -fold replication of v = p σ −1 (0, 1, . . . , p s+1−σ − 1), and o(w2 ) = p s+1−σ . By Corollary 2, we have that Φ(w2 ) + Φ(u) = Φ(w2 + u − p(w2  p u)). Since Φ(u) ∈ K (H ), p(w2  p u) ∈ H. Let w2 = (w1 , w2 , . . . , wn ) and [w j,0 , w j,1 , . . . , w j,s−1 ] p be the p-ary expansion of w j , s−2 j ∈ {1, . . . , n}. Note that, by Lemma 2, we have that p(w2  p u) = p i=σ −1 (w2  p λi p ) = i s−2 p i=σ −1 Ti p ∈ H, where Ti = (t1,i , t2,i , . . . , tn,i ), and t j,i = 1 if w j,i + λi ≥ p and i t j,i = 0 otherwise. s Let τ = i=1 ti . Since σ ≤ s − 1, τ ≥ 2. If τ = 2, then H has length m = p s+1−σ and the only rows in At1 ,...,ts are 1 and w2 . Note that, in this case, w2 = v. If τ ≥ 3, for k ∈ {3, . . . , τ }, the k-th row wk of At1 ,...,ts contains zeros in the first p s+1−σ coordinates by construction. Hence, for τ ≥ 2, any element of H restricted to the first p s+1−σ coordinates s−2 is of the form μ1 1 + μ2 v for some μ1 , μ2 ∈ Z ps . We have that p i=σ i −1 Ti p restricted  s−2  i  to the first m = p s+1−σ coordinates is p i=σ −1 T i p , where Ti = (t1,i , t2,i , . . . , tm,i ). s−2  Therefore, we have to find μ1 , μ2 ∈ Z ps such that p i=σ −1 Ti p = μ1 1 + μ2 v.i Since the first coordinate of v is 0, the first coordinate of v(i) is 0 for all i ∈ {0, . . . , s − 1}. Then, we have that μ1 = 0, so  s−2 p Ti pi = μ2 v. (6) i=σ −1 s−1 (i) i s−1 (i) i s−2  i Note that v = i=0 v p = i=σ −1 v p . Let x = p i=σ −1 Ti p and y = μ2 v. On the one hand, we assume that μ2 ∈ A = {0, p s−σ +1 , . . . , ( p − 1) p +1 }, and then y = 0. s−σ Moreover, since there exists λi0  = 0, we have that Ti0 has at least a nonzero coordinate, so x  = 0 and we get a contradiction. On the other hand, we assume that μ2 ∈ Z ps \ A. Let x(i) = (x1,i , x2,i , . . . , xm,i ), σ ≤ i ≤ s − 1. Note that x j,i ∈ {0, 1} for all j ∈ {1, 2, . . . , m} and i ∈ {σ, . . . , s − 1}. However, since v = p σ −1 (0, 1, . . . , p s+1−σ − 1), there exists i 1 ∈ {σ, . . . , s − 1} such that the coordinates of y(i1 ) are not in {0, 1}, and hence we obtain a contradiction. Therefore, if u  = 0, then p(w2  p u)  = μ1 1 + μ2 v and hence u = 0. 123 On the linearity and classification of Zps -linear... 1049 Lemma 4 Let H = Ht1 ,...,ts be the Z ps -additive GH code of type (n; t1 , . . . , ts ) with p ≥ 3 s  −ts prime. Let wk be the k-th row of At1 ,...,ts and τ = i=1 ti . Let M = {v = τk=2 λk wk : s−2 λk ∈ Z ps , o(v) > p}, N = { i=σ −1 iλ p i : λ ∈ Z } if σ ≤ s − 1, and N = {0}, otherwise. i p Let M + N = {vM +vN : vM ∈ M ∪{0}, vN ∈ N }. Then, Φ(M + N )∩ K (Φ(H)) = {0}. Proof Let H = Φ(H), which has length N = n · p s−1 . By Lemma 3, we already know that Φ(N ) ∩ K (H ) = {0}.  −ts Now, we prove that Φ(M) ∩ K (H ) = ∅. Let v = τk=2 λk wk = (v1 , v2 , . . . , vn ) ∈ M. Since o(v) > p and o(wk ) ≤ p s+1−σ , o(v) = p for some 2 ≤ q ≤ s +1−σ . By the iterative q construction (5) of At1 ,...,ts , we know that all the elements of Z ps of order equal to or less than pq appear as a coordinate of v. Let [v j,0 , v j,1 , . . . , v j,s−1 ] p be the p-ary expansion of v j , j ∈ {1, . . . , n}. By Corollary 4, we have that Φ(v)+Φ(ps−q ) = Φ(v+ps−q − p s−q+1 Ts−q ), where Ts−q = (t1,(s−q) , t2,(s−q) , . . . , tn,(s−q) ), and for j ∈ {1, . . . , n} , t j,(s−q) = 1 if v j,(s−q) = p − 1 and 0 otherwise. Again, it is enough to see that p s−q+1 Ts−q ∈ / H to prove  −ts that Φ(v) ∈ / K (H ). Since, v = τk=2 λk wk = (v1 , v2 , . . . , vn ) and o(v) = pq for some 2 ≤ q ≤ s + 1 − σ , we have that, by construction, v contains every element of p s−1 Z ps exactly α times, α > 0, and the remaining n − pα coordinates are from Z ps \ p s−1 Z ps . So, wt H (Φ( p s−q+1 Ts−q )) ≤ (n − pα)·( p −1) p s−2 < n ·( p −1) p s−2 = N ( p −1)/ p = d(H ). Therefore, Φ(v) ∈ / K (H ) and Φ(M) ∩ K (H ) = ∅. Now, we prove that Φ(M + N ) ∩ K (H ) = {0}. Let v = vM + vN ∈ (M + N )\{0}, where vM ∈ M and vN ∈ N . We just proved that Φ(v) ∈ / K (H ) if vM = 0 or vN = 0. Therefore, we can assume that vM  = 0 and vN  = 0. We know that vN = (v, . . . , v). Let [v0 , v1 , . . . , vs−1 ] p be the p-ary expansion of v. Let vN1 and vN2 be the elements of Z ps having p-ary expansion [0, . . . , 0, vs−q , . . . , vs−1 ] p and [v0 , . . . , vs−q−1 , 0, . . . , 0] p , respectively. Then, vN = vN1 + vN2 , where vNi = (vNi , . . . , vNi ) for i ∈ {1, 2}. Since o(vM ) = pq with 2 ≤ q ≤ s +1−σ , the p-ary expansion of each one of its coordinates is of the form [0, . . . , 0, (vM )s−q , . . . , (vM )s−1 ] p . Note that we also have that o(vN1 ) ≤ o(vM ) by construction. It is easy to see that p(vN2  p ps−q ) = 0. Therefore, wt H (Φ( p(v  p ps−q ))) = wt H (Φ( p((vM + vN1 )  p ps−q ))). Since o(vN1 ) ≤ o(vM ), it is easy to see that there exists a permutation of coordinates π such that π(vM + vN1 ) = vM . Thus, wt H (Φ( p((vM + vN1 )  p ps−q ))) = wt H (Φ( p(vM  p ps−q ))), and since o(vM ) = pq with 2 ≤ q ≤ s + 1 − σ , we get a contradiction as above. Therefore, Φ(v) ∈ / K (H ) and Φ(M + N ) ∩ K (H ) = {0}. Theorem 4 Let H = Ht1 ,...,ts be the Z ps -additive GH code of type (n; t1 , . . . , ts ) with p ≥ 3 prime. Let H p be the subcode of H which contains all the codewords of order p. Let M = {pm }σm=0 −2 if σ ≥ 2, and M = ∅ if σ = 1. Then,   Φ(H p ), Φ(M) = K (Φ(H)) s and ker(Φ(H)) = ( i=1 ti ) + σ − 1. Proof The result follows by Proposition 5 and Lemma 4. Corollary 6 Let H = Ht1 ,...,ts be the Z ps -additive GH s code of type (n; t1 , . . . , ts ) withτ p ≥ 3 prime. Let wk be the k-th row of At1 ,...,ts and τ = i=1 ti . Let Q = {(o(wk )/ p)wk }k=1 and M = {pm }σm=0 −2 if σ ≥ 2, and M = ∅ if σ = 1. Then, {Φ(Q), Φ(M)} is a basis of K (Φ(H)). 123 1050 D. K. Bhunia et al. Example 10 Let H31,1,0 be the Z27 -linear GH code. By Theorem 4, we have that ker(H31,1,0 ) = 3 since σ = 2. Moreover, we can construct K (H31,1,0 ) from a basis by Corollary 6. We have that Q = {9, (0, 9, 18, 0, 9, 18, 0, 9, 18)} and M = {1}. Thus, K (H31,1,0 ) = Φ(9), Φ((0, 9, 18, 0, 9, 18, 0, 9, 18)), Φ(1). More generally, if H p1,1,0 is a Z p3 -linear GH code with p an odd prime, then we have that K (H p1,1,0 ) = Φ(p2 ), Φ(u), Φ(1), where u is the p-fold replication of (0, p 2 , 2 p 2 , . . . , ( p − 1) p 2 ), so ker(H p1,1,0 ) = 3. Note that ker(H21,1,0 ) = 5 since H21,1,0 is linear [11]. Example 11 Let H32,0,0 be the Z27 -linear GH code considered in Example 7. By Theorem 4, we have that ker(H32,0,0 ) = 2 since σ = 1. Moreover, we can construct K (H32,0,0 ) from a basis by Corollary 6. We have that Q = {9, u = (0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18, 0, 9, 18)} and M = ∅. Thus, K (H32,0,0 ) = Φ(9), Φ(u). In the general case of the Z p3 -linear GH codes H p2,0,0 with p an odd prime, we have that K (H p2,0,0 ) = Φ(p2 ), Φ(u), where u is the p 2 -fold replication of (0, p 2 , 2 p 2 , . . . , ( p − 1) p 2 ), so ker(H p2,0,0 ) = 2. Note that ker(H22,0,0 ) = 3 [11]. 6 Classification of Zps -linear GH codes The classification of the Z4 -linear Hadamard codes of length 2t , for any t ≥ 3, using the rank or the dimension of the kernel is shown in [18, 21]. In [11], it is shown that the dimension of the kernel can not be used to establish a complete classification of the Z2s -linear Hadamard codes of length 2t , in general, for any t ≥ 3 and s > 2. However, it is also shown that this invariant allows us to obtain some partial results on the classification of these codes, through some examples. In this section, we obtain these results for Z ps -linear GH codes of length p t , with t ≥ 1, s ≥ 2 and p an odd prime, which do not coincide exactly with the case p = 2. Moreover, we also establish for which parameters t and s the dimension of the kernel gives a full classification, and give the exact number of non-equivalent codes in these cases. By Theorem 3, for any t ≥ 1, s ≥ 2, and p ≥ 3 prime, there is exactly one Z ps -linear GH code of length p t , H 1,0,...,0,ts , that is linear. Moreover, the following result implies that we can focus on t ≥ 5 and 2 ≤ s ≤ t − 2 to classify the nonlinear ones. Theorem 5 Let At,s, p be the number of non-equivalent Z ps -linear GH codes of length p t , and p ≥ 3 prime. Then, ⎧ ⎪ ⎪ 0 if t ≥ 3 and s ≥ t + 2, ⎨ 1 if t ≥ 3 and s ∈ {t, t + 1}, At,s, p = ⎪ ⎪ 2 if t ≥ 3 and s = t − 1, ⎩ 2 if t = 4 and s = 2, and the Z ps -linear GH code is linear when At,s, p = 1. Moreover, if t ≥ 5 and 2 ≤ s ≤ t − 2, then At,s, p ≥ 2, and there is one which is linear and at least one which is nonlinear. 123 On the linearity and classification of Zps -linear... 1051 Proof First, if t ≥ 3 and s ≥ t + 2, then the equation  s  t= (s − i + 1) · ti − 1, (7) i=1 with t1 ≥ 1, does not have any non-negative integer solution, so At,s, p = 0. If t ≥ 3 and s = t + 1, then (7) has only one solution (t1 , . . . , ts ) = (1, 0, . . . , 0). If t ≥ 3 and s = t, (7) has only the solution (1, 0, . . . , 0, 1). By Theorem 3, for all the above solutions, we obtain exactly one linear code H t1 ,...,ts . Note that, when t = 3 and s = 2, the solutions are (1, 2) and (2, 0); when t ≥ 4 and s = t − 1, the only two solutions are (1, 0, . . . , 0, 2) and (1,0,…,0,1,0); and when t = 4 and s = 2, the solutions are (1, 3) and (2, 1). By Theorem 3, for these cases, we obtain exactly one linear code and one nonlinear code, so At,s, p = 2. Finally, when t ≥ 5 and s = 2, (7) always has at least the solutions (t1 , t2 ) = (1, t +1 −2) and (2, t+1−4); and when t ≥ 5 and 2 < s ≤ t−2, at least the solutions (1, 0, . . . , 0, t−s+1) and (1, 0, . . . , 0, 1, t − s − 1). By Theorem 3, there is exactly one linear code and at least one nonlinear code, so At,s, p ≥ 2. The following example shows that the dimension of the kernel can not be used, in general, to classify completely all nonlinear Z ps -linear GH codes of length p t , once t ≥ 5 and 2 ≤ s ≤ t − 2 are fixed. Example 12 The Z p3 -linear GH codes of length p 8 (t = 8 and s = 3) are the following: H p1,0,6 , H p1,1,4 , H p1,2,2 , H p1,3,0 , H p2,0,3 , H p2,1,1 and H p3,0,0 . When p is an odd prime, their kernels are of dimension 9, 7, 6, 5, 5, 4 and 3, respectively, by Theorem 4. Therefore, by using this invariant, we can say that all of them are non-equivalent except H p1,3,0 and H p2,0,3 , which have the same dimension of the kernel. Note that, as shown in [11], for p = 2, the codes H21,1,4 and H21,0,6 are linear, and hence equivalent, whereas H p1,1,4 is nonlinear when p ≥ 3. By using the computer algebra system Magma [6], when p = 3, we have that rank(H31,3,0 ) = 22 and rank(H32,0,3 ) = 16, so they are non-equivalent. Actually, all these Z33 -linear GH codes have ranks 9, 14, 22, 16, 26, 48 and 10, respectively, so we can use the rank instead of the dimension of the kernel to classify completely the Z33 -linear GH codes of length 38 = 6561. As shown in the next example, for some values of t ≥ 5 and 2 ≤ s ≤ t − 2, it is indeed possible to establish a complete classification by using just the dimension of the kernel. Actually, in Theorem 6, we show some infinite families of parameters for which this is also true. Example 13 By Theorem 4, it is possible to check that, for any 5 ≤ t ≤ 7, 2 ≤ s ≤ t − 2 and p an odd prime, all nonlinear Z ps -linear GH codes of length p t have a different dimension of the kernel, so this invariant allows us to classify them. For t = 8, t = 9 and t = 10, it also works, except when s ∈ {3}, s ∈ {3, 4} and s ∈ {3, 4, 5}, respectively. For these given values of t and s, we can just obtain a partial classification by using the kernel. By using Magma, we have also computed the rank of the nonlinear Z3s -linear GH codes of length 3t , for any 4 ≤ t ≤ 10 and 2 ≤ s ≤ t − 1. Indeed, Tables 4 and 5 show the values of (t1 , . . . , ts ) and the pair (r , k), where r is the rank and k the dimension of the kernel, for all these codes. Note that the values of (t1 , . . . , ts ) and k do not depend on p, so they are the same for any p ≥ 3 prime. Therefore, the results given in Examples 12 and 13 can also be checked 123 1052 D. K. Bhunia et al. Table 2 Number At,s,3 of t 3 4 5 6 7 8 9 10 non-equivalent Z3s -linear GH codes of length 3t Z32 2 2 3 3 4 4 5 5 Z33 1 2 3 4 5 7 8 10 Z34 1 1 2 3 5 6 9 11 Z35 0 1 1 2 3 5 7 10 Z36 0 0 1 1 2 3 5 7 Z37 0 0 0 1 1 2 3 5 Z38 0 0 0 0 1 1 2 3 Z39 0 0 0 0 0 1 1 2 by looking at these tables. They also show that all nonlinear Z3s -linear GH codes of length 3t have different values of the rank, once 5 ≤ t ≤ 10 and 2 ≤ s ≤ t − 2 are fixed. Therefore, for these cases, as in Example 12, we have that the codes are pairwise non-equivalent. This gives us a complete classification, by using the rank, and the number As,t,3 of non-equivalent Z3s -linear GH codes of length 3t , as shown in Table 2 for any 3 ≤ t ≤ 10 and 2 ≤ s ≤ t + 1. The cases where the dimension of the kernel is not enough to classify them are shown in bold type. Theorem 6 Let At,s, p be the number of non-equivalent Z ps -linear GH codes of length p t . Then, for any t ≥ 3, 2 ≤ s ≤ t − 1 and p ≥ 3 prime,  s  At,s, p ≤ |{(t1 , . . . , ts ) ∈ Ns : t = (s − i + 1) · ti − 1, t1 ≥ 1}|. i=1 Moreover, this bound is tight in the following cases: 1. for any t ≥ 3 and s = 2, 2. for any 3 ≤ t ≤ 7 and 2 ≤ s ≤ t + 1, 3. for any t ≥ 7 and s = t − 2, 4. for any t ≥ 7 and s = t − 3, 5. for any t ≥ 9 and s = t − 4, 6. for t = 8 and s = 4, 7. for p = 3, any 3 ≤ t ≤ 10 and 2 ≤ s ≤ t + 1. Proof Item 2 is given by Example 13. Item 7 is true by Tables 4 and 5, since given any possible t and s, all the codes have a different value of the rank. For Item 1, since t ≥ 3 and s = 2, the solutions of (7) are (t1 , t − 2t1 + 1), where t1 ≥ 1 and t + 1 ≥ 2t1 . If t1 = 1, the solution is (1, t − 1), and then the dimension of the kernel of the corresponding code is 1 + t − 1 + 2 − 1 = t + 1. If t1 ≥ 2, then the dimension of the kernel is t −t1 +1+1−1 = t +1−t1 by Theorem 4, which gives different values for distinct values of t1 . Therefore, in this case, we see that there are exactly t+1 2 non-equivalent codes. For Item 3, since t ≥ 7 and s = t − 2, then s ≥ 5. Therefore, we have at least five terms in the addition part of equation t + 1 = (t − 2)t1 + (t − 3)t2 + · · · + 2tt−3 + tt−2 , with t1 ≥ 1, and hence we have exactly three solutions, which are (1, 0, . . . , 0, 3), (1, 0, . . . , 0, 1, 1), and (1, 0, . . . , 0, 1, 0, 0). The dimensions of the kernel for the corresponding codes are 4 + t − 2 − 1 = t + 1, 3 + t − 3 − 1 = t − 1 and 2 + t − 4 − 1 = t − 3, respectively. Since all these values are different, in this case, we have exactly three non-equivalent codes. 123 On the linearity and classification of Zps -linear... 1053 For Item 4, if t = 7 and s = 4, then we already know that there are exactly five non- equivalent codes by Item 2. If t ≥ 8 and s = t − 3, then by applying the same argument as in Item 3, we have exactly five solutions: (1, 0, . . . , 0, 1, 0, 0, 0), (1, 0, . . . , 0, 1, 0, 1), (1, 0, . . . , 0, 2, 0), (1, 0, . . . , 0, 4) and (1, 0, . . . , 0, 1, 2). The dimensions of the kernel for the corresponding codes are t −5, t −3, t −2, t +1 and t −1, respectively. Again, since these values are different for a given t, in this case, we have exactly five non-equivalent codes. For Item 5, if t = 9 and s = 5, we have exactly seven solutions: (1, 0, 0, 0, 5), (1, 0, 0, 2, 1), (1, 0, 1, 0, 2), (1, 0, 1, 1, 0), (1, 1, 0, 0, 1), (2, 0, 0, 0, 0) and (1, 0, 0, 1, 3), and the dimen- sions of the kernel for the corresponding codes are 10, 7, 6, 5, 4, 2 and 8, respectively. If t ≥ 9 and s = t − 4, then by applying the same argument as in Item 3, we have exactly seven solutions: (1, 0, . . . , 0, 5), (1, 0, . . . , 0, 2, 1), (1, 0, . . . , 0, 1, 0, 2), (1, 0, . . . , 0, 1, 1, 0), (1, 0, . . . , 0, 1, 0, 0, 1), (1, 0, . . . , 0, 1, 0, 0, 0, 0) and (1, 0, . . . , 0, 0, 1, 3), and the dimensions of the kernel for the corresponding codes are t + 1, t − 2, t − 3, t − 4, t − 5, t − 7 and t − 1, respectively. Finally, since these values are different, we have exactly seven non-equivalent codes. For Item 6, since t = 8 and s = 4, we have exactly six solutions: (1, 0, 0, 5), (1, 0, 2, 1), (1, 1, 0, 2), (1, 1, 1, 0), (2, 0, 0, 1) and (1, 0, 1, 3) and the dimensions of the ker- nel for the corresponding codes are 9, 6, 5, 4, 3 and 7, respectively. Again, since these values are different, we have exactly six non-equivalent codes. Corollary 7 Let At,s, p be the number of non-equivalent Z ps -linear GH codes of length p t , and p ≥ 3 prime. Then, 1. At,s, p = t+1 2 if t ≥ 3 and s = 2, 2. At,s, p as in Table 2 if 3 ≤ t ≤ 7 and 2 ≤ s ≤ t + 1, 3. At,s, p = 3 if t ≥ 7 and s = t − 2, 4. At,s, p = 5 if t ≥ 7 and s = t − 3, 5. At,s, p = 7 if t ≥ 9 and s = t − 4, 6. At,s, p = 6 if t = 8 and s = 4, 7. At,s, p as in Table 2 if p = 3, 3 ≤ t ≤ 10 and 2 ≤ s ≤ t + 1. Proof It follows by the proof of Theorem 6. Corollary 8 Let At,s,2 be the number of non-equivalent Z2s -linear GH codes of length 2t . Then, 1. At,s,2 = t+1 2 − 1 if t ≥ 3 and s = 2, 2. At,s,2 as in Table 2 given in [11] if 3 ≤ t ≤ 11 and 2 ≤ s ≤ t + 1, 3. At,s,2 = 2 if t ≥ 7 and s = t − 2, 4. At,s,2 = 4 if t ≥ 7 and s = t − 3, 5. At,s,2 = 6 if t ≥ 9 and s = t − 4, 6. At,s,2 = 5 if t = 8 and s = 4. Proof Recall that Item 1 is proved in [18, 21]. The proof of the other items follows by the same arguments as in the proof of Theorem 6, but using previous results given in Theorems 2, 3, 4 and 5, and Table 2 from [11]. Note that Theorem 5 gives As,t, p for the extreme cases when there are only one or two non-equivalent codes, and together with the results given by Corollary 7, we conjecture that they cover all cases when the kernel allows us to classify Z ps -linear GH codes of length p t with p ≥ 3 prime. Indeed, they do cover all cases that are not in bold type in Table 2. We 123 1054 D. K. Bhunia et al. Table 3 Bounds for the number t 3 4 5 6 7 8 9 10 At, p of non-equivalent Z ps -linear GH codes of length lower bound K 2 2 4 4 6 6 8 8 pt lower bound RK ( p = 3) 2 2 4 4 7 8 12 14 upper bound 2 3 6 9 15 22 33 46 also give As,t,2 for the same cases in Corollary 8, since they were not included in [11]. Note that the values of As,t,2 are different from As,t, p with p ≥ 3 prime, but they just differ by one unit, because two of the codes are linear, instead of just one. Next, we focus on Z ps -linear GH codes, once only the length p t is fixed. First, Example 14 shows that there are Z ps -linear GH codes with s > 2, which are not equivalent to any Z p2 -linear GH code of the same length p t . Then, Example 15 also shows that there are Z p2 -linear GH codes which are not equivalent to any Z ps -linear GH codes with s > 2. Example 14 Let H p2,0,0 be the Z p3 -linear GH code of length p 5 with p an odd prime. Recall that ker(H p2,0,0 ) = 2 by Theorem 4, and hence H p2,0,0 is nonlinear. By Corollary 7, there are three Z p2 -linear GH codes of length p 5 , H p1,4 , H p2,2 and H p3,0 . The first one is linear, and the last two have ker(H p2,2 ) = 4 and ker(H p3,0 ) = 3 by Theorem 4. Hence, there is no Z p2 -linear GH code equivalent to the Z p3 -linear GH code H 2,0,0 of length p 5 . Example 15 By Theorem 3 or Table 4, we have that there are five nonlinear Z ps -linear GH codes of length p 5 (t = 5): H p2,2 , H p3,0 , H p2,0,0 , H p1,1,1 and H p1,0,1,0 . Recall that the values of (t1 , . . . , ts ) and k do not depend on the value of p. It is easy to see that H p3,0 is not equivalent to any Z ps -linear GH codes with s > 2, by considering just the dimension of the kernel. Other examples like this one can be found when t is odd, and at least for p = 3. For example, by Tables 4 and 5, for t = 7 and t = 9 there are Z32 -linear GH codes, H34,0 and H35,0 , respectively, which are not equivalent to any Z3s -linear GH codes with s > 2 of the same length, by using both invariants: the rank and dimension of the kernel. Finally, we establish some lower and upper bounds on the number of non-equivalent Z ps - linear GH codes of length p t , when only the length p t is fixed, for some values of t. By Theorem 4, we can determine a lower bound (K) taking into account just the dimension of the kernel. This lower bound can be improved (RK) if we consider both invariants, the rank and the dimension of the kernel, at least for p = 3 and t ≤ 10. Note that there are codes having the same dimension of the kernel with different ranks (for p = 3 and t = 7, 8, 9, 10), and codes having the same rank with different dimensions of the kernel (for p = 3 and t = 9, 10). An upper bound can be given easily by considering all non-equivalent Z ps -linear GH codes of length p t , once t and s are fixed, as it is shown in the next theorem. Theorem 7 Let At,s, p be the number of non-equivalent Z ps -linear GH codes of length p t , and p ≥ 3 prime. Let At, p be the number of non-equivalent Z ps -linear GH codes of length  p t , for any s ≥ 2. Then, At, p ≤ t−1 s=2 (At,s, p − 1) + 1. The results related to the upper and lower bound of the value At, p are summarized in Table 3, where we give these bounds for all 3 ≤ t ≤ 10. 123 On the linearity and classification of Zps -linear... 1055 Table 4 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) Z32 (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) (14,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) 7 Conclusions and further research In this paper, we establish the classification of the Z ps -linear GH codes of length p t once t, s, and p are fixed, giving the exact number At,s, p of non-equivalent such codes for all possible parameters, except for t ≥ 8 and 3 ≤ s ≤ t − 5. For these values, at least if p = 3 and t = 8, 9, 10 (and p = 2 and t = 8, 9, 10, 11 [11]), there are codes with the same dimension of the kernel, so this invariant can not be used to fully classify. However, in these cases, we have checked that the rank classifies. We conjecture that, even though there are some cases when the dimension of the kernel does not classify, the rank always does, and thus At,s, p coincides with the upper bound given in Theorem 6 if p is an odd prime, and the one given in [11,Theorem 5] if p = 2. On the other hand, when only t and p are fixed, at least if p = 2 and p = 3, we have Z ps -linear GH codes of length p t (with different values of s) which have the same values for the rank and dimension of the kernel. For p = 2, these codes are equivalent as shown in [12]. Another further research on this topic would be to determine whether they are also equivalent for any odd prime p. The Z ps -linear GH codes studied in this paper are the ones obtained by using Carlet’s Gray map. As mentioned in the introduction, there are other Gray maps, which could be used to generate GH codes from the Z ps -additive codes Htp1 ,...,ts constructed in Sect. 3 for p > 2 prime or in [11] for p = 2. However, the results about the linearity, kernel, rank, and classification would be different. For example, the Z16 -linear Hadamard code Φ(H21,1,0,0 ) has rank r = 9 andkernel of dimension k = 4 [11]. By using other Gray maps φ  such that  λi φ  (2i )  = φ  ( λi 2i ), the parameters (r , k) become (9, 2), (11, 3), (11, 2), and (13, 2), so we could obtain new non-equivalent GH codes. 123 1056 D. K. Bhunia et al. Table 5 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) Z32 (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) (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) 123 On the linearity and classification of Zps -linear... 1057 Table 5 continued t =8 t =9 t = 10 (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) (t1 , . . . , ts ) (r , k) 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) Acknowledgements The authors thank Adrián Torres for reviewing the latest version of the paper. They also 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. 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. Armario, J.A., Bailera, I., Egan, R.: Butson full propelinear codes. preprint arXiv:2010.06206 (2020) 2. Assmus E.F., Key J.D.: Designs and Their Codes. Cambridge University Press, Cambridge (1992). 3. Bauer H., Ganter B., Hergert F.: Algebraic techniques for nonlinear codes. Combinatorica 3(1), 21–33 (1983). 4. Blake I.F.: Codes over integer residue rings. Information and Control 29(4), 295–300 (1975). 5. 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). 6. Bosma, W., Cannon, J.J., Fieker, C., Steel, A.: Handbook of Magma functions. Edition 2.25 (2020). http:// magma.maths.usyd.edu.au/magma/ 7. Carlet C.: Z2k -linear codes. IEEE Trans. Inf. Theory 44(4), 1543–1547 (1998). 8. Constantinescu I., Heise W.: A metric for codes over residue class rings. Problemy Peredachi Informatsii 33(3), 22–28 (1997). 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. Gupta M.K., Bhandari M.C., Lal A.K.: On linear codes over Z2s . Des. Codes Cryptogr. 36(3), 227–244 (2005). 123 1058 D. K. Bhunia et al. 15. 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). 16. Honold T., Nechaev A.A.: Weighted modules and representations of codes. Probl. Inf. Transm. 35(3), 205–223 (1999). 17. Jungnickel D.: On difference matrices, resolvable transversal designs and generalized Hadamard matrices. Math. Z. 167(1), 49–60 (1979). 18. Krotov D.S.: Z4 -linear Hadamard and extended perfect codes. Electron. Notes Discret Math. 6, 107–112 (2001). 19. Krotov D.S.: On Z2k -dual binary codes. IEEE Trans. Inf. Theory 53(4), 1532–1537 (2007). 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. Shankar P.: On BCH codes over arbitrary integer rings. IEEE Trans. Inf. Theory 25(4), 480–483 (1979). 23. 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). 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. Tapia-Recillas H., Vega G.: On Z2k -linear and quaternary codes. SIAM J. Discret Math. 17(1), 103–113 (2003). Publisher’s Note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. 123