Hamming Distance of Constacyclic Codes of Length <italic>p<sup>s</sup></italic> Over F<sub><italic>p<sup>m</sup></italic></sub>+<italic>u</italic>F<sub><italic>p<sup>m</sup></italic></sub>+<italic>u</italic>²F<sub><italic>p<sup>m</sup></italic></sub>

Let <inline-formula> <tex-math notation="LaTeX">$p$ </tex-math></inline-formula> be any prime, <inline-formula> <tex-math notation="LaTeX">$s$ </tex-math></inline-formula> and <inline-formula> <tex-math notation="LaTeX">$m$ </tex-math></inline-formula> be positive integers. In this paper, we completely determine the Hamming distance of all constacyclic codes of length <inline-formula> <tex-math notation="LaTeX">$p^s$ </tex-math></inline-formula> over the finite commutative chain ring <inline-formula> <tex-math notation="LaTeX">$\mathbb {F}_{p^m}+ u\mathbb {F}_{p^m} + u^{2}\mathbb {F}_{p^m}\,\,\, (u^3=0)$ </tex-math></inline-formula>. As applications, we identify all maximum distance saparable codes (i.e., optimal codes with respect to the Singleton bound) among them.


I. INTRODUCTION
Constacyclic codes form one of the most important class of codes, due to their easiness in encoding and decoding via simple shift registers, and their many practical applications.This class of codes can be seen as a generalization of cyclic codes, that have been extensively studied since the late 1950s (cf.[25]- [29]).
Let F p m be a finite field of p m elements, where p is a prime, and let ≥ 2 be an integer.Then the ring R = F p m [u]/ u = F p m +uF p m +. ..+u −1 F p m (u = 0) is a finite commutative chain ring.Many new and good codes have been constructed by using this type of commutative chain rings (see, for instance, ( [18], [31], [32]).Finite commutative chain rings also have practical applications in connections between modular lattices and linear codes over F p +uF p [3].When = 2, there are a lot of literatures on constacyclic codes over rings F p m [u]/ u 2 = F p m +uF p m for various prime p and positive integers m (see, e.g., [1], [2], [4], [8], [10]- [13], [16], [17], [19], [30].)In particular, structure of and Hamming distance distibution of all constacyclic codes of length p s over F p m +uF p m were completely determined in [8], [14], [21].When = 3, in 2015, [34] determined the structure of (δ+αu 2 )-constacyclic codes of length p s over F p m [u]/ u 3  = F p m +uF p m +u 2 F p m .Recently, [22] obtained The associate editor coordinating the review of this manuscript and approving it for publication was Xueqin Jiang .
the structure of all constacyclic codes of length p s over F p m + uF p m +u 2 F p m by classifying them into 8 types.[33] studies the structure of repeated-root constacyclic codes of any length over F p m +uF p m +u 2 F p m and provided the Hamming distnace of some of them.However, the complete Hamming distance distribution of all constacyclic codes of length p s over F p m +uF p m +u 2 F p m was still left open.That motivates us to complete that task in this paper.As an application, we use this Hamming distance distribution to identify all MDS codes among them.These MDS codes are optimal in the sense that among codes of the same length and dimension, they have the best error-correcting capacities.

II. SOME PRELIMINARIES
For a fintie ring R, consider the set R n of n-tuples of elements from R as a module over R in the usual way.A subest C ⊆ R n is called a linear code of length n over R if C is an R-submodule of R n .For a unit λ of R, the λ-constacyclic (λ-twisted) shift τ λ on R n is the shif τ λ ((x 0 , x 1 , . . ., x n−1 )) = (λx n−1 , x 0 , x 1 , . . ., x n−2 ), and a code C is said to be λ-constacyclic if τ λ (C) = C, i.e., if C is closed under the λ-constacyclic shift τ λ .In case λ = 1, those λ-constacyclic codes are called cyclic codes, and when λ = −1, such λ-constacyclic codes are called negacyclic codes.
Each codeword c = (c 0 , c 1 , . . ., c n−1 ) ∈ C is customarily identified with its polynomial representation c(x) = c 0 +c 1 x+• • •+c n−1 x n−1 , and the code C is in turn identified with the set of all polynomial representations of its codewords.Then in the ring R[x]/ x n −λ , xc(x) corresponds to a λ-constacyclic shift of c(x).From that, the following fact is well known (cf.[20], [23]) and straightforward: The zero code is conventionally said to have Hamming distance 0.
In this paper, let F p m be a finite field of p m elements, where p is a prime number, and denote The ring R can be expressed as It is easy to check that R is a local ring with maximal ideal u = uF p m .Therefore, it is a chain ring.Every invertible element in R is of the form: a+bu+cu 2 where a, b, c ∈ F p m and a = 0.
From now onwards, we shall focus our attention on γ -constacyclic codes of length p s over R, i.e., ideals of the ring where γ is a nonzero element of F p m .By applying the Division Algorithm, there exist nonnegative integers γ q , γ r such that s = γ q m+γ r with 0 = γ .In [22], Laaouine et al. classified all γ -constacyclic codes of length p s over R and their detailed structures are also established.
Theorem 1 (cf.[22]): The ring R γ is a local ring with maximal ideal u, x−γ 0 , but it is not a chain ring.The γconstacyclic codes of length p s over R, i.e, ideals of the ring R γ , are Type 1 (C 1 ) : Type 2 (C 2 ) : Type 3 (C 3 ) : F p m and h 0 = 0.Here L is the smallest integer satisfying u 2 (x−γ 0 ) L ∈ C 3 .Type 4 (C 4 ) : Here U is the smallest integer satisfying u(x−γ 0 ) U +u 2 g(x) ∈ C 5 , for some g(x) ∈ R γ and V is the smallest integer such that u 2 (x−γ 0 ) V ∈ C 5 .Type 6 (C 6 ) : c j (x−γ 0 ) j with c j ∈ F p m , c 0 = 0.Here W is the smallest integer satisfying u 2 (x−γ 0 ) W ∈ C 7 and U is the smallest integer satisfying u(x−γ 0 ) U +u 2 g(x) ∈ C 5 , for some g(x) ∈ R γ .
Type 8 (C 8 ) : , for some g(x) ∈ R γ and W is the smallest integer such that u 2 (x−γ 0 ) W ∈ C 7 .Proposition 2 (cf.[22]): We have Theorem 2 (cf.[22]): Let C be a γ -constacyclic codes of length p s over R. Then following the same notations as in Theorem 1, we have the following results:

III. HAMMING DISTANCE
In [7], [8] the algebraic structure and Hamming distances of γ -constacyclic codes of length p s over F p m were established and given by the following theorem.Theorem 3 (cf.[7], [8]): As we mentioned in Section II the γ -constacyclic codes of length p s over R are precisely the ideals of the ring R γ .In order to compute the Hamming distances of all γ -constacyclic codes of length p s over R, we count the Hamming distance of the ideals of the ring R γ as classified into 8 types in Theorem 1.
It is easy to see that d H (C 1 ) = 0 when C 1 = {0}, and that , which are given in Theorem 3. Theorem 4: Let C 2 = u 2 (x−γ 0 ) τ be a γ -constacyclic codes of length p s over R of Type 2 (as classified in Theorem 1), where 0 ≤ τ ≤ p s −1.Then the Hamming distance of C 2 is given by In order to compute the Hamming distances of those codes for the rest cases (Type 3, 4, 5, 6, 7 and 8), we first observe that where a(x) ∈ R γ .
Theorem 5: be a γ -constacyclic codes of length p s over R of Type 3 (as classified in Theorem 1).Then the Hamming distance of C 3 is given by . Now, consider an arbitrary polynomial c(x) ∈ C 3 .Thus, by (1), we obtain that The rest of the proof follows from Theorem 3 and the discussion above.
Theorem 6: (as classified in Theorem 1).Then the Hamming distance of C 4 is given by (1), we obtain that The rest of the proof follows from Theorem 3 and the discussion above.
Theorem 7: x) be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1).Then the Hamming distance of C 5 is given by . Now, consider an arbitrary polynomial c(x) ∈ C 5 .Thus, by (1), we obtain that The rest of the proof follows from Theorem 3 and the discussion above.
Theorem 8: Proof: First of all, since u 2 (x−γ 0 ) c ∈ C 6 , it follows that Now, consider an arbitrary polynomial c(x) ∈ C 6 \ u 2 (x− γ 0 ) c .Thus, by (1), we obtain that The rest of the proof follows from Theorem 3 and the discussion above.
Theorem 9: x) be a γ -constacyclic codes of length p s over R of Type 7 (as classified in Theorem 1).Then the Hamming distance of C 7 is given by Now, consider an arbitrary polynomial c(x) ∈ C 7 .We consider two cases.* Case 1: c(x) ∈ u .In this case, by (1).We have . * Case 2: c(x) / ∈ u .In this case, by (1).We have ).The rest of the proof follows from Theorem 3 and the discussion above.
Theorem 10: be a γ -constacyclic codes of length p s over R of Type 8 (as classified in Theorem 1).Then the Hamming distance of C 8 is given by We consider two cases.* Case 1: c(x) ∈ u .In this case, by (1).We have . * Case 2: c(x) / ∈ u .In this case, by (1).We have . The rest of the proof follows from Theorem 3 and the discussion above.

IV. MAXIMUM DISTANCE SEPARABLE CODES WITH RESPECT TO HAMMING DISTANCE
In [24] Definition 1: Let C be a linear code of length n over R.Then, C is said to be a maximum distance separable (MDS) code with respect to the Hamming distance if it attains the Singleton bound.
In this section, we identify the MDS codes for each type of γ -constacyclic codes one by one.First, we consider the γ -constacyclic codes of length p s of Type 1.
Theorem 12: Let C 1 be a γ -constacyclic code of length p s over R of Type 1 (as classified in Theorem 1), then the only MDS code is 1 .
Case 2: For C 1 to be MDS we must have, |C 1 | = p 3m(p s −d H (C 1 )+1) , i.e., p 3mp s = p 3m(p s −1+1) , which is true for all p and s.Thus, the code C 1 is MDS in this case.
Now we examine the MDS condition for Type 2 γ -constacyclic codes.
Theorem 13: Let C 2 = u 2 (x−γ 0 ) τ be a γ -constacyclic codes of length p s over R of Type 2 (as classified in Theorem 1), where 0 ≤ τ ≤ p s −1.Then no MDS codes exist.Proof: Here, we have We consider two cases as follows: Case 1: If τ = 0, then d H (C 2 ) = 1.For C 2 to be MDS we must have, p s = 0, which is not true for any p and s.Thus, C 2 is not MDS for τ = 0.
Case 2: Here, we consider the γ -constacyclic codes of Type 3 to verify the MDS condition for these codes.Here, we have Hence, follows the theorem.Theorem 14: Let C 3 = u(x−γ 0 ) δ +u 2 (x−γ 0 ) t h(x) be a γ -constacyclic codes of length p s over R of Type 3 (as classified in Theorem 1).Then, there is no MDS code.
Proof: We consider two cases as follows: Case 1: If L = 0, then d H (C 3 ) = 1.For C 3 to be MDS we must have, δ = −p s , which is not true for any p and s.Thus, C 3 is not MDS for L = 0.
−2, i.e., L = p s −1, which is a contradiction, since L ≤ δ.Thus, there is no MDS code in this case.Now we examine the MDS condition for Type 4 γ -constacyclic codes.
Theorem 15:  −d H (C 5 )+1) , i.e., V = 3d H (C 5 )− a−U−3.Thus, we get the following cases: Case 1: When h 1 (x) = h 2 (x) = 0 then, V = U = a.For C 5 to be MDS we must have a = d H (C 5 )−1.Hence, the MDS codes for Type 5 ideals are similar to the MDS γ -constacyclic codes over F p m [15, Corollary 13].Hence, we have the following theorem: Theorem 16: Let C 5 = (x−γ 0 ) a be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1).Then C 5 is a MDS code if and only if one of the following conditions holds: then, V = U = a.For C 5 to be MDS we must have a = d H (C 5 )−1, which is similar to the result in case 1.But we have 1 ≤ a ≤ p s +t 2 2 and 0 ≤ t 2 < a, which implies that max{2a−p s , 0} ≤ t 2 < a.Hence, we conclude the following theorem.
Theorem 17: Let C 5 = (x−γ 0 ) a +u 2 (x−γ 0 ) t 2 h 2 (x) be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1), where h 2 (x) = 0 and 1 ≤ a ≤ p s +t 2 2 .Then C 5 is a MDS code if and only if one of the following conditions holds: then, V = U = a.For C 5 to be MDS we must have a = d H (C 5 )−1, which is similar to the result in case 1.But we have 1 ≤ a ≤ p s +t 1 2 and 0 ≤ t 1 < a, which implies that max{2a−p s , 0} ≤ t 1 < a.Hence, we conclude the following theorem.
Theorem 18: x) be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1), where h 1 (x) = 0 and 1 ≤ a ≤ p s +t 1 2 .Then C 5 is a MDS code if and only if one of the following conditions holds: Case 4: When h 1 (x) = 0 and p s +t 1 2 < a ≤ p s −1 then, V = U = p s −a+t 1 .For C 5 to be MDS we must have a = 2p s −3d H (C 5 )+2t 1 +3.Hence, follows the theorem.Theorem 19: Let C 5 = (x−γ 0 ) a +u(x−γ 0 ) t 1 h 1 (x)+u 2 (x− γ 0 ) t 2 h 2 (x) be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1), where h 1 (x) = 0 and Then, there is no MDS code.
Case 5: −a+t 2 and U = a.For C 5 to be MDS we must have a = 3d H (C 5 )−p s −t 2 −3.Hence, follows the theorem.Theorem 20: Let C 5 = (x−γ 0 ) a +u 2 (x−γ 0 ) t 2 h 2 (x) be a γ -constacyclic codes of length p s over R of Type 5 (as classified in Theorem 1), where h 2 (x) = 0 and p s +t 2 2 < a ≤ p s −1.Then, there is no MDS code.< a ≤ p s −1, i.e., p s −1 < a ≤ p s −1, which is a contradiction.Thus, there is no MDS code in this case.
Here, we consider the γ -constacyclic codes of Type 6 to verify the MDS condition for these codes.
Proof: Here, we have We consider two cases as follows: Case 1: For C 6 to be MDS we must have, a = −U, which is contradiction, since 0 < U ≤ a.
Now, c ≥ 3 d H (C 6 )−2a−3 if and only if a ≥ p s −1, i.e., equality when a = p s −1.Thus, equality occurs when n = p−1, k = s−1, a = p s −1, i.e., c = p s −1, which is a contradiction, since c < a.Thus, there is no MDS code in this case.
• Type 8: No MDS constacyclic code can be obtained in this case.
Using the results in Sections III and IV, we list all Hamming distances d H of such codes and the number of codewords |C| in each of those constacyclic codes.We also give all MDS and non-MDS codes (Table 1).
Among these 82 codes, 31 of them are MDS codes.* Type 1 (C 1 ): 0 , 1 .* Type 2 (C 2 ): Example 2: We obtain cyclic codes corresponding to the unit γ = 1.cyclic codes of length 8 over the chain ring R = F 2 +uF 2 +u 2 F 2 are precisely the ideals of R[x]/ x 8 −1 .The following Tables 2, 3, 4, 5, 6 and 7 shows the representation of all cyclic codes C of length 8 over the chain ring F 2 +uF 2 +u 2 F 2 of Type 1, 2 and 3 (of Type 4, of Type 5  generators of the constacyclic codes and their corresponding conditions to be MDS codes are given as follows: • Type 1 (C 1 ): 0 , 1 .For these codes the condition for MDS code are given by 3 = d H (C 1 ) and 1 = d H (C 1 ).As mentioned in Section IV, the only MDS constacyclic codes in this case is 1 .
• Type 6: C 6 = (x−γ ) a +u(x−γ ) t 1 h 1 (x)+u 2 (x− γ ) t 2 h 2 (x), u 2 (x−γ ) c , where 0 ≤ c < a ≤ 48, 0 ≤ t 1 < a, 0 ≤ t 2 < c, either h 1 (x), h 2 (x) are 0 or are Let γ be an any nonzero element of the finite field F p m .It is well known that the γ -constacyclic codes of length p s over R are ideals of the ring R[x]/ x p s −γ which is a local ring with the maximal ideal u, x−γ 0 , but it is not a chain ring.Determining the Hamming distances of constacyclic codes and obtaining MDS constacyclic codes are very important in coding theory.Motivated by this, in this research article, we completed the problem of determining the Hamming distances of all γ -constacyclic codes by study their classifications of 8 types.Using these distances, we then obtain all MDS codes among such codes.We also give some examples in which we discuss the parameters of some MDS constacyclic codes for different values of p and s in Tables 1, 2, 3, 4, 5, 6, 7 and 8.
For future work, it would be interesting to determine the symbol-pair distances of γ -constacyclic codes of length of length p s over R, and to determine MDS symbol-pair γ -constacyclic codes of length p s over R.

Proposition 1 :
A linear code C of length n is λ-constacyclic over R if and only if C is an ideal of R[x]/ x n −λ .For a codeword x = (x 0 , x 1 , . . ., x n−1 ) ∈ R n , the Hamming weight of x, denoted by wt H (x), is the number of nonzero components of x.The Hamming distance d H (x, y) of two words x and y equals the number of components in which they differ, which is the Hamming weight wt H (x−y) of x−y.For a nonzero linear code C, the Hamming weight wt H (C) and the Hamming distance d H (C) are the same and defined as the smallest Hamming weight of nonzero codewords of C: either 0 or a unit in R γ of the form W−t 2 −1 j=0 b j (x−γ 0 ) j with b j ∈ F p m , b 0 = 0 and h 3 (x) is either 0 or a unit in R γ of the form W−t 3 −1 j=0 p s over R of Type 6 (as classified in Theorem 1).Then the Hamming distance of C 6 is given by , Norton et al. discussed the Singleton bound for finite chain ring R with respect to the Hamming distance d H (C) and is given as |C| ≤ |R| (n−d H (C)+1) .Maximum Distance Separable (MDS) codes are classified as an important class of linear codes that meet the Singleton bound.They have high error correction capability as compared to non MDS codes.Theorem 11 (Singleton Bound With Respect to Hamming Distance [24]): Let C be a linear code of length n over R with Hamming distance d H (C).Then, the Singleton bound with respect to the Hamming distance d H (C) is given by |C| ≤ p 3m(n−d H (C)+1) .

TABLE 1 .
γ -constacyclic codes of length 3 over the chain ring

TABLE 2 .
Cyclic codes of length 8 over the chain ring F 2 +uF 2 +u 2 F 2 of Type 1, 2 and 3.

TABLE 3 .
Cyclic codes of length 8 over the chain ring F 2 +uF 2 +u 2 F 2 of Type 4.

TABLE 6 .
Cyclic codes of length 8 over the chain ring F 2 +uF 2 +u 2 F 2 of Type 6 and 7.