Article

# The MacWilliams Identity for the *m*-Spotty Weight Enumerators
over $\mathbb{Z}_p R_k$

Juan Wang <fnref n="1" />,*, An Jiang <fnref n="2" /> and Patrick Solé <fnref n="3" />

## Abstract

In this paper, we investigate the *m*-spotty weight enumerators over the mixed alphabet $\mathbb{Z}_p R_k$. Specifically, we construct the Gray map from $\mathbb{Z}_p^\alpha \times R_k^\beta$ to $\mathbb{Z}_p^{\alpha+k\beta}$, where $R_k = \mathbb{Z}_p + v\mathbb{Z}_p + v^2\mathbb{Z}_p + \cdots + v^{k-1}\mathbb{Z}_p$ with $v^k = 0$ and $k \ge 5$. Based on this framework, we establish the MacWilliams identity for the *m*-spotty weight enumerators between a linear code and its dual over $\mathbb{Z}_p R_k$, by employing the generalized Hadamard transform and the canonical additive character of $\mathbb{Z}_p$. Finally, an example is presented to illustrate and validate the theoretical results.

**Keywords:** MacWilliams identity; *m*-spotty weight; group character

## 1. Introduction

In coding theory, it is customary to use generating functions that enumerate codewords by their Hamming weights to evaluate the probability of decoding errors over noisy channels. This generating function, which takes the form of a polynomial, is known as the **weight enumerator**. In 1963, MacWilliams established a fundamental relation between the weight enumerators of a linear code and its dual, now known as the **MacWilliams identity**. This identity has become one of the cornerstones of algebraic coding theory, providing a powerful connection between a code and its dual [1–5].

Error control codes play a vital role in enhancing the reliability of communication and data storage systems. To address more complex noise environments, spotty and *m*-spotty byte error models were introduced [6]. These models, which generalize the classical bit-level error model introduced by Shannon, allow for the detection and correction of localized byte errors and thus require generalized weight functions beyond the standard Hamming weight.

In recent years, many researchers have extended the MacWilliams identities to a variety of weights and algebraic structures, including finite rings. For instance, Suzuki et al. [7] derived the MacWilliams identity for binary *m*-spotty weight enumerators. Siap and Özen [8,9] generalized these results to finite fields and to rings such as $\mathbb{F}_2 + u\mathbb{F}_2$ with $u^2 = 0$, and further to $\mathbb{F}_2 + u\mathbb{F}_2 + \cdots + u^{m-1}\mathbb{F}_2$ with $u^m = 0$. They also established the corresponding identities for RT-weight enumerators over arbitrary finite fields [10,11]. Moreover, Siap [12] obtained the MacWilliams identity for *m*-spotty Lee weight enumerators over $\mathbb{Z}_4$. Subsequently, Sharma and Sharma [12] investigated *m*-spotty weight enumerators over integer modular rings and two-byte error control codes, deriving several applications and

<figure><img src="image_1.png" /></figure>

Check for updates

Academic Editor: Lu Wei

Received: 17 November 2025

Revised: 28 December 2025

Accepted: 29 December 2025

Published: 31 December 2025

**Copyright:** © 2025 by the authors.
Licensee MDPI, Basel, Switzerland.
This article is an open access article
distributed under the terms and
conditions of the Creative Commons
Attribution (CC BY) license.

<footnote n="1">¹ Department of Base Courses, Anhui Sanlian University, Hefei 230601, China</footnote>

<footnote n="2">² College of General Education, Anhui Wenda University of Information Engineering, Hefei 231201, China;
bgs@wenda.edu.cn</footnote>

<footnote n="3">³ lab I2M (CNRS, Centrale Marseille, Aix-Marseille University), 13009 Marseilles, France; sole@enst.fr</footnote>

<footnote>* Correspondence: tggxb@mail.slu.edu.cn</footnote>
their associated MacWilliams identities. A general overview of such developments can be found in [13].

In this work, we continue this line of research by introducing the *m*-spotty weight and the associated weight enumerators over the mixed ring $\mathbb{Z}_p R_k$, where $\mathbb{Z}_p$ denotes the ring of integers modulo $p$ and $R_k = \mathbb{Z}_p + v\mathbb{Z}_p + v^2\mathbb{Z}_p + \cdots + v^{k-1}\mathbb{Z}_p$ with $v^k = 0$ and $k \ge 5$. We then establish the MacWilliams identity for linear codes over this mixed alphabet and their duals. The paper is organized as follows. Section 2 recalls basic concepts and preliminaries. Section 3 presents the MacWilliams identity for *m*-spotty weight enumerators over $\mathbb{Z}_p R_k$. Section 4 concludes the paper.

## 2. Preliminaries

Let $R$ be a finite commutative ring. A linear code of length $n$ over $R$ is an $R$-submodule of $R^n$. A matrix $G$ is called a *generator matrix* of the linear code $C$ if the rows of $G$ generate $C$ as an $R$-module. For any vector $\mathbf{x} = (x_1, x_2, \dots, x_n) \in R^n$, the *Hamming weight* of $\mathbf{x}$ is defined as $w_H(\mathbf{x}) = |\{i | x_i \neq 0, 1 \le i \le n\}|$. For any $\mathbf{x} = (x_1, \dots, x_n)$ and $\mathbf{y} = (y_1, \dots, y_n) \in R^n$, the *Hamming distance* between $\mathbf{x}$ and $\mathbf{y}$ is

$$d(\mathbf{x}, \mathbf{y}) = |\{i | x_i \neq y_i, 1 \le i \le n\}|.$$

### 2.1. The MacWilliams Identity over the Finite Field $\mathbb{F}_q$

Let $\mathbb{F}_q$ denote the finite field with $q$ elements, where $q$ is a prime power. An $[n, k, d]$ linear code $C$ over $\mathbb{F}_q$ is a $k$-dimensional subspace of $\mathbb{F}_q^n$, where $d$ is the minimum nonzero Hamming weight of $C$. Let $A_i$ denote the number of codewords in $C$ with Hamming weight $i$, where $i = 0, 1, \dots, n$. Then the vector $(A_0, A_1, \dots, A_n)$ is called the *weight distribution* of $C$, and the polynomial $A(z) = A_0 + A_1z + \dots + A_nz^n$ is the *weight enumerator* of $C$. The *dual code* of a linear code $C$ is defined by $C^\perp = \{\mathbf{x} \in \mathbb{F}_q^n | \mathbf{x} \cdot \mathbf{y} = 0, \forall \mathbf{y} \in C\}$, where $\mathbf{x} \cdot \mathbf{y} = x_1y_1 + x_2y_2 + \dots + x_ny_n$. for vectors $\mathbf{x} = (x_1, \dots, x_n)$ and $\mathbf{y} = (y_1, \dots, y_n) \in \mathbb{F}_q^n$.

The MacWilliams identity establishes the relation between the weight enumerators of a code and its dual.

**Theorem 1.** Let $C$ be an $[n, k]$ linear code over $\mathbb{F}_q$ with weight enumerator $A(z)$. Let $B(z)$ denote the weight enumerator of its dual code $C^\perp$. Then

$$B(z) = q^{-k}(1 + (q-1)z)^n A\left(\frac{1-z}{1+(q-1)z}\right).$$

### 2.2. Codes over the Mixed Ring $\mathbb{Z}_p R_k$

Throughout this paper, let $\mathbb{Z}_p$ denote the ring of integers modulo $p$, and let $R_k = \mathbb{Z}_p + v\mathbb{Z}_p + v^2\mathbb{Z}_p + \cdots + v^{k-1}\mathbb{Z}_p$, where $v^k = 0$ and $k \ge 5$. For any vectors $\mathbf{x} = (x_1, \dots, x_\alpha | x_{\alpha+1}, \dots, x_{\alpha+\beta})$, $\mathbf{y} = (y_1, \dots, y_\alpha | y_{\alpha+1}, \dots, y_{\alpha+\beta})$ in $\mathbb{Z}_p^\alpha \times R_k^\beta$, their inner product is defined as

$$\langle \mathbf{x}, \mathbf{y} \rangle = v^{k-1} \sum_{i=1}^{\alpha} x_i y_i + \sum_{i=\alpha+1}^{\alpha+\beta} x_i y_i.$$

For any element $s = s_0 + s_1v + \cdots + s_{k-1}v^{k-1} \in R_k$, define the projection $\eta(s) = s_0$. For $s \in R_k$ and $\mathbf{x} \in \mathbb{Z}_p^\alpha \times R_k^\beta$, define $s\mathbf{x} = (\eta(s)x_1, \dots, \eta(s)x_\alpha | s x_{\alpha+1}, \dots, s x_{\alpha+\beta})$. A linear code $C$ of type $(\alpha, \beta)$ over $\mathbb{Z}_p R_k$ is defined as a $R_k$-submodule of $\mathbb{Z}_p^\alpha \times R_k^\beta$ under the above multiplication.

The *dual code* of a linear code $C$ of type $(\alpha, \beta)$ over $\mathbb{Z}_p R_k$ is given by

$$C^{\perp} = \{ \mathbf{y} \in \mathbb{Z}_p^{\alpha} \times R_k^{\beta} | \langle \mathbf{x}, \mathbf{y} \rangle = 0, \forall \mathbf{x} \in C \}.$$
The Gray map $\varphi: \mathbb{Z}_p^\alpha \times R_k^\beta \to \mathbb{Z}_p^{\alpha+k\beta}$ is defined by

$$ \varphi(a | b) = (a_1, \dots, a_\alpha | \varphi(b_1), \dots, \varphi(b_\beta)), $$

where the component map $\varphi: R_k \to \mathbb{Z}_p^k$ is given by

$$ \varphi(s_0 + s_1 v + \dots + s_{k-1} v^{k-1}) = (s_0 + s_1 + \dots + s_{k-1}, s_1 + \dots + s_{k-1}, \dots, s_{k-1}). $$

### 2.3. The m-Spotty Weight over $\mathbb{Z}_p R_k$

Let $c = (c_{11}, \dots, c_{1b}, \dots, c_{n1}, \dots, c_{nb}) \in \mathbb{Z}^{nb}$ be a codeword of length $N = nb$. The $i$-th byte of $c$ is denoted by $c_i = (c_{i1}, c_{i2}, \dots, c_{ib})$. For a byte of length $b$, if at most $t$ errors occur in that byte, then such an error is called an m-spotty byte error or a $t/b$-error, where $1 \le t \le b$ [14].

**Definition 1.** Let $e \in \mathbb{Z}^N$ be an error vector, and let $e_i \in \mathbb{Z}^b$ be its $i$-th byte ($1 \le i \le n$). The m-spotty weight of $e$ is defined as

$$ w_M(e) = \sum_{i=1}^{n} \left\lfloor \frac{w_H(e_i)}{t} \right\rfloor, $$

where $\lceil x \rceil$ denotes the smallest integer not less than $x$ [14]. If $t=1$, then $w_M(e) = w_H(e)$, i.e., the standard Hamming weight. If $t=b$, then the m-spotty Hamming weight coincides with the usual Hamming weight over $\mathbb{F}_p^b$.

For $\mathbb{Z}_p R_k = \{(e_1, e_2) | e_1 \in \mathbb{Z}_p, e_2 \in R_k\}$, errors may occur in both components $e_1$ and $e_2$. Since it is difficult to compute the m-spotty weight directly on $R_k$, we apply the mapping $\varphi$ to convert elements in $R_k$ and then compute the m-spotty weight by counting the nonzero components.

**Definition 2.** For any element $(a^\alpha | a^\beta) = (a_1, \dots, a_\alpha | a_{\alpha+1}, \dots, a_{\alpha+\beta}) \in \mathbb{Z}_p^\alpha \times R_k^\beta$, define $w_M(a^\alpha | a^\beta) = w_M(a^\alpha) + w_M(a^\beta)$. Let $C$ be a linear code of type $(\alpha, \beta)$ over $\mathbb{Z}_p R_k$ and $N = \alpha + k\beta$. Then the m-spotty weight enumerator of $C$ is defined by

$$ W_{M_C}(x, y) = \sum_{c \in C} x^{N-w_M(c)} y^{w_M(c)} = \sum_{i=0}^{N} A_i x^{N-i} y^i, $$

where $(A_0, A_1, \dots, A_N)$ denotes the m-spotty weight distribution of $C$.

In $\mathbb{Z}_p$, let $\zeta = e^{\frac{2\pi i}{p}}$. The canonical additive character of $\mathbb{Z}_p$ is $\chi(x) = \zeta^x$ for $x \in \mathbb{Z}_p$. Any element $r \in R_k$ can be uniquely expressed as

$$ r = a_0 + a_1 v + \dots + a_{k-1} v^{k-1}, \quad a_i \in \mathbb{Z}_p. $$

Then the canonical additive character on $R_k$ is defined as

$$ \chi(r) = \zeta^{a_{k-1}}. $$

Consequently, for any element $e = (e_1, e_2) \in \mathbb{Z}_p R_k$, where $e_1 \in \mathbb{Z}_p$ and $e_2 = \sum_{i=0}^{k-1} a_i v^i \in R_k$, the corresponding character is

$$ \chi(e) = \zeta^{e_1 + a_{k-1}}. $$
### 3. MacWilliams Identity for m-Spotty Weight over $\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta$

In this section, we establish the MacWilliams identity for the m-spotty weight over $\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta$. Based on Lemmas 2.1, 2.2, and 2.8 in [8], and by following their proof techniques, we derive the following lemmas.

**Lemma 1.** Let $H \neq \{0\}$ be an ideal of $\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta$, and let $\chi$ be a character over $\mathbb{Z}_p R_k$. Then the sum of the character values of all elements in $H$ equals zero, i.e.,

$$ \sum_{h \in H} \chi(h) = 0. $$

**Lemma 2.** For any $r \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta$, let $\chi$ be a character over $\mathbb{Z}_p R_k$. Then

$$ \sum_{z \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(rz) = \begin{cases} |\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta|, & r = 0, \\ 0, & r \neq 0. \end{cases} $$

**Proof.** There are three cases to consider:

* If $r = 0$, then

$$ \sum_{z \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(rz) = \sum_z \chi(0) = \sum_z 1 = |\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta|. $$

* If $r \neq 0$ and $r = v$, then by Lemma 1, we have

$$ \sum_{z \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(rz) = \sum_{z \in \langle v \rangle} \chi(z) = 0, $$

where $\langle v \rangle$ denotes the ideal generated by $v$.

* If $r \neq 0$ and $r \neq v$, then similarly, Lemma 1 implies

$$ \sum_{z \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(rz) = \sum_z \chi(z) = 0. $$

This completes the proof. □

**Lemma 3.** Let $C$ be a linear code over $\mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta$, and let $C^\perp$ denote its dual code. Let $f: \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta \to C$ be a function, and define

$$ \hat{f}(e) = \sum_{t \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(\langle e, t \rangle) f(t), $$

called the generalized Hadamard transform of $f(t)$. Then

$$ \sum_{t \in C^\perp} f(t) = \frac{1}{|C|} \sum_{e \in C} \hat{f}(e). $$

**Proof.** Since $\hat{f}(e) = \sum_{t \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(\langle e, t \rangle) f(t)$, then

$$ \begin{aligned} \sum_{e \in C} \hat{f}(e) &= \sum_{e \in C} \sum_{t \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta} \chi(\langle e, t \rangle) f(t) \\ &= \sum_{e \in C} \sum_{t \in C^\perp} \chi(\langle e, t \rangle) f(t) + \sum_{e \in C} \sum_{t \in \mathbb{Z}_p^\alpha \times \mathbb{R}_k^\beta \setminus C^\perp} \chi(\langle e, t \rangle) f(t). \end{aligned} $$
For the first half to the right of the equal sign, since $e \in C, t \in C^{\perp}$, then $\langle e, t \rangle = 0$. By Lemma 2, it is easy to know that the first half is equal to

$$|C| \sum_{t \in C^{\perp}} f(t).$$

And for the latter half, since $e \in C, t \in \mathbb{Z}_p^\alpha \times R_k^\beta \setminus C^{\perp}$, then $\langle e, t \rangle \neq 0$, From Lemma 2, we know that $\sum_{e \in C} \chi(\langle e, t \rangle) = 0$. Therefore

$$\sum_{e \in C} \sum_{t \in \mathbb{Z}_p^\alpha \times R_k^\beta \setminus C^{\perp}} \chi(\langle e, t \rangle) f(t) = \sum_{t \in \mathbb{Z}_p^\alpha \times R_k^\beta \setminus C^{\perp}} \sum_{e \in C} \chi(\langle e, t \rangle) f(t) = 0.$$

Hence

$$\sum_{e \in C} \hat{f}(e) = \sum_{e \in C} \sum_{t \in \mathbb{Z}_p^\alpha \times R_k^\beta} \chi(\langle e, t \rangle) f(t) = |C| \sum_{t \in C^{\perp}} f(t),$$

$$\text{This means that } \sum_{t \in C^{\perp}} f(t) = \frac{1}{|C|} \sum_{e \in C} \hat{f}(e). \quad \square$$

**Lemma 4.** Let $u \in \mathbb{Z}_p^\alpha \times R_k^\beta$ and let $\chi$ be a character over $\mathbb{Z}_p R_k$. Then

$$\sum_{s \in \mathbb{Z}_p^\alpha \times R_k^\beta} \chi(\langle u, s \rangle) x^{N-w_M(s)} y^{w_M(s)} = (x + (p-1)y)^{N-w_M(u)} (x-y)^{w_M(u)},$$

where $N = \alpha + k\beta$.

**Proof.** We first define $N = \alpha + k\beta$, $u_{\alpha+j} = u_{\alpha+j}^0 + v u_{\alpha+j}^1 + \dots + v^{k-1} u_{\alpha+j}^{k-1}$, $s_{\alpha+j} = s_{\alpha+j}^0 + v s_{\alpha+j}^1 + \dots + v^{k-1} s_{\alpha+j}^{k-1}$, where $j = 1, 2, \dots, \beta$. Then

$$\text{left} = \sum_{s^\alpha \in \mathbb{Z}_p^\alpha} \sum_{s^\beta \in R_k^\beta} \chi(\langle u^\alpha, s^\alpha \rangle) x^{\alpha - w_M(s^\alpha)} y^{w_M(s^\alpha)} \chi(\langle u^\beta, s^\beta \rangle) x^{k\beta - w_M(s^\beta)} y^{w_M(s^\beta)} \\ = \left( \prod_{i=1}^{\alpha} \sum_{s_i \in \mathbb{Z}_p} \xi^{u_i s_i} x^{1-w_M(s_i)} y^{w_M(s_i)} \right) \left( \prod_{j=1}^{\beta} \sum_{s_{\alpha+j} \in R_k} \xi^{u_{\alpha+j} s_{\alpha+j}} x^{k-w_M(s_{\alpha+j})} y^{w_M(s_{\alpha+j})} \right).$$

For the first half, according to the definition of *m*-spotty weight for any *t*, we have

* If $u_i = 1$, then $s_i \neq 0$, $w_M(s_i) = 1$ or $s_i = 0$, $w_M(s_i) = 0$. After substituting these in, we can obtain

$$\sum_{s_i \in \mathbb{Z}_p} \xi^0 x^{1-w_M(s_i)} y^{w_M(s_i)} = \xi^0 x + \sum_{i=1}^{p-1} \xi^i y = x - y.$$

* If $u_i = 0$, then $s_i \neq 0$, $w_M(s_i) = 1$ or $s_i = 0$, $w_M(s_i) = 0$. After substituting these in, we can obtain

$$\sum_{s_i \in \mathbb{Z}_p} \xi^0 x^{1-w_M(s_i)} y^{w_M(s_i)} = \xi^0 x + (p-1)\xi^0 y = x + (p-1)y.$$
Obviously the degrees of $x + (p-1)y$ and $x - y$ are $1 - w_M(u_i)$ and $w_M(u_i)$, respectively. The second half of the proof is similar to the first half, then we have

$$ \text{left} = \left( \prod_{i=1}^{\alpha} (x + (p-1)y)^{1-w_M(u_i)} (x-y)^{w_M(u_i)} \right) \left( \prod_{j=1}^{\beta} \sum_{\substack{s_{\alpha+j}^l \in R_k \\ l=0,1,\dots,k-1}} \xi^{\sum_{\substack{n+l=k-1 \\ n,l \in \mathbb{Z}_p}} \sum_{\alpha+j} u_{\alpha+j}^n s_{\alpha+j}^l} x^{k-w_M(s_{\alpha+j})} y^{w_M(s_{\alpha+j})} \right) \\ = \left( \prod_{i=1}^{\alpha} (x + (p-1)y)^{1-w_M(u_i)} (x-y)^{w_M(u_i)} \right) \left( \prod_{j=1}^{\beta} (x + (p-1)y)^{k-w_M(u_{\alpha+j})} (x-y)^{w_M(u_{\alpha+j})} \right) \\ = (x + (p-1)y)^{N-w_M(u)} (x-y)^{w_M(u)}. $$

This completes the proof. □

**Theorem 2.** Let $C$ be a linear code over $\mathbb{Z}_p^\alpha \times R_k^\beta$. Then the relation between the $m$-spotty weight enumerator of $C$ and its dual $C^\perp$ is

$$ W_{M_C^\perp}(x, y) = \frac{1}{|C|} W_{M_C}(x + (p-1)y, x - y). $$

**Proof.** Let $f(t) = x^{N-w_M(t)}y^{w_M(t)}$, then by Lemma 4 we have

$$ \begin{aligned} \hat{f}(e) &= \sum_{t \in \mathbb{Z}_p^\alpha \times R_k^\beta} \chi(\langle e, t \rangle) f(t) = \sum_{t \in \mathbb{Z}_p^\alpha \times R_k^\beta} \chi(\langle e, t \rangle) x^{N-w_M(t)} y^{w_M(t)} \\ &= (x + (p-1)y)^{N-w_M(e)} (x-y)^{w_M(e)}. \end{aligned} $$

According to Lemma 3, for any $e \in C, t \in C^\perp$, we have

$$ \begin{aligned} W_{M_C^\perp}(x, y) &= \sum_{t \in C^\perp} x^{N-w_M(t)} y^{w_M(t)} \\ &= \sum_{t \in C^\perp} f(t) \\ &= \frac{1}{|C|} \sum_{e \in C} \hat{f}(e) \\ &= \frac{1}{|C|} \sum_{e \in C} \chi(\langle e, t \rangle) (x + (p-1)y)^{N-w_M(e)} (x-y)^{w_M(e)} \\ &= \frac{1}{|C|} W_{M_C}(x + (p-1)y, x-y). \end{aligned} $$

This implies that $W_{M_C^\perp}(x, y) = \frac{1}{|C|} W_{M_C}(x + (p-1)y, x - y)$. □

Next, we provide a specific example to illustrate our theorem. For convenience, let $p = 3$ and $k = 2$. We consider the MacWilliams identity for the $m$-spotty weight of composite ring $\mathbb{Z}_3 R_2 = \{(e_1, e_2) \mid e_1 \in \mathbb{Z}_3, e_2 \in R_2\}$.
**Example 1.** Let $C$ be a linear code over $\mathbb{Z}_3^2 \times \mathbb{Z}_2^2$ with generation matrix

$$G_1 = \begin{pmatrix} 2 & 0 & | & v & 0 \\ 0 & 1 & | & 0 & 2v \end{pmatrix}.$$

We can verify that the row vector of the matrix is linearly independent and $|C| = 9$. The m-spotty weight for codewords of $C$ can be obtained in Table 1. From this, we can obtain the m-spotty weight distribution of $C$, as shown in Table 2.

<table><caption>**Table 1.** The m-spotty weight of codewords of $C$.</caption><thead><tr><th>Codeword</th><th>w<sub>M</sub>(c)</th><th>Codeword</th><th>w<sub>M</sub>(c)</th><th>Codeword</th><th>w<sub>M</sub>(c)</th></tr></thead><tbody><tr><td>(0 0|0 0)</td><td>0</td><td>(0 2|0 v)</td><td>2</td><td>(2 2|v v)</td><td>4</td></tr><tr><td>(0 1|0 2v)</td><td>2</td><td>(1 0|2v 0)</td><td>2</td><td>(1 1|2v 2v)</td><td>4</td></tr><tr><td>(2 0|v 0)</td><td>2</td><td>(2 1|v 2v)</td><td>4</td><td>(1 2|2v v)</td><td>4</td></tr></tbody></table>

<table><caption>**Table 2.** Weight distribution of $C$.</caption><tbody><tr><td>w<sub>M</sub>(c)</td><td>0</td><td>1</td><td>2</td><td>3</td><td>4</td></tr><tr><td>A<sub>i</sub></td><td>1</td><td>0</td><td>4</td><td>0</td><td>4</td></tr></tbody></table>

Then we can easily calculate the m-spotty weight enumerators of $c$ by the weight distribution $W_M(c) = x^6 + 4x^4y^2 + 4x^2y^4$. Therefore, by Theorem 2, we can obtain

$$ 
\begin{aligned}
W_{M C^{\perp}}(x, y) &= \frac{1}{|C|} W_{M C}(x + (p-1)y, x - y) \\
&= \frac{1}{9} W_{M C}(x + (p-1)y, x - y) \\
&= \frac{1}{9} \left( (x + 2y)^6 + 4(x + 2y)^4(x - y)^2 + 4(x + 2y)^2(x - y)^4 \right) \\
&= x^6 + 4x^5y^2 + 8x^4y^2 + 16x^3y^3 + 20x^3y^3 + 16xy^5 + 16y^6
\end{aligned}
$$

This is the m-spotty weight counter for the corresponding dual code $C^{\perp}$.

## 4. Conclusions

In this paper, we introduced the concepts of error control codes and MacWilliams identities, and defined the m-spotty weight over the mixed alphabet $\mathbb{Z}_p R_k$ via a Gray map from $\mathbb{Z}_p^\alpha \times R_k^\beta$ to $\mathbb{Z}_p^{\alpha+k\beta}$. By constructing additive characters and employing the generalized Hadamard transform, we derived the MacWilliams identity relating the m-spotty weight enumerators of a code and its dual over $\mathbb{Z}_p R_k$. Finally, we provided an explicit example to verify the theoretical results.

**Author Contributions:** Writing—original draft preparation, J.W. and A.J.; writing—review and editing, P.S. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research is supported by the Natural Science Foundation of Anhui Province Higher School (2023AH051697, 2023AH051682,2022AH020099).

**Data Availability Statement:** No new data were created or analyzed in this study.

**Conflicts of Interest:** The authors declare no conflicts of interest.
## References

1. MacWilliams, J. A Theorem on the Distribution of Weights in a Systematic Code. *Bell Syst. Tech. J.* **1963**, *42*, 79–94.

2. Özen, M.; Siap, V. The MacWilliams identity for *m*-spotty weight enumerators of linear codes over finite fields. *Comput. Math. Appl. Int. J.* **2011**, *61*, 1000–1004.

3. Sharma, A.; Sharma, A.K. On MacWilliams type identities for *r*-fold joint *m*-spotty weight enumerators. *Discret. Math.* **2012**, *312*, 3316–3327.

4. Sharma, A.; Sharma, A.K. MacWilliams type identities for some new *m*-spotty weight enumerators. *IEEE Trans. Inf. Theory* **2012**, *58*, 3912–3924.

5. Shi, M.; Wang, D.; Solé, P. Linear codes over $F_3 + uF_3 + u^2F_3$: MacWilliams identities, optimal ternary codes from one-Lee weight codes and two-Lee weight codes. *J. Appl. Math. Comput.* **2016**, *51*, 527–544.

6. Umanesan, G.; Fujiwara, E. A class of random multiple bits in a byte error correcting and single byte error detecting (St/bEC-SbED) codes. *IEEE Trans. Comput.* **2003**, *52*, 835–847.

7. Suzuki, K.; Kashiyama, T.; Fujiwara, E. A general class of *m*-spotty weight enumerator. *Ieice Trans. Fundam. Electron. Commun. Comput. Sci.* **2007**, *90*, 1418–1427.

8. Siap, I. MacWilliams identity for *m*-spotty Lee weight enumerators. *Appl. Math. Lett.* **2010**, *23*, 13–16.

9. Siap, V.; Özen, M. A MacWilliams Type identity for *m*-spotty Rosenbloom-Tsfasman weight enumerators over Frobenius rings. In *CMMSE 2013: Proceedings of the 13th International Conference on Mathematical Methods in Science and Engineering, Almeria, Spain*, 23–27 June 2013; pp. 1236–1241.

10. Özen, M.; Shi, M.; Siap, V. An identity between the *m*-spotty Rosenbloom-Tsfasman weight numerators over finite commutative Frobenius rings. *Bull. Korean Math. Soc.* **2015**, *52*, 809–823.

11. Özen, M.; Siap, V. The MacWilliams identity for *m*-spotty Rosenbloom-Tsfasman weight enumerator. *J. Frankl. Inst. 2014*, *351*, 743–750.

12. Sharma, A.; Sharma, A.K. On some new *m*-spotty Lee weight enumerators. *Des. Codes Cryptogr.* **2014**, *71*, 119–152.

13. Shi, M.; Choie, Y.; Sharma, A.; Solé, P. *Codes and Modular Fors: A Dictionary*; World Scientific: Singapore, 2020.

14. Siap, I. An identity between the *m*-spotty weight enumerators of a linear code and its dual. *Turk. J. Math.* **2012**, *36*, 641–650.

**Disclaimer/Publisher's Note:** The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.