PERFECT CODES IN THE HOMOGENEOUS
METRIC

Jinjiao Xu, Minjia Shi, Patrick Solé

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

To cite this version:

Jinjiao Xu, Minjia Shi, Patrick Solé. PERFECT CODES IN THE HOMOGENEOUS METRIC.
Bulletin of the Australian Mathematical Society, inPress. hal-05304741

HAL Id: hal-05304741

https://hal.science/hal-05304741v1

Submitted on 9 Oct 2025

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_2.png" /></figure>
PERFECT CODES IN THE HOMOGENEOUS METRIC

JINJIAO XU, MINJIA SHI and PATRICK SOLÉ

Abstract

We study perfect codes in the homogeneous metric over the ring $Z_{2^k}, k > 2$. Arithmetic non-existence results are derived from Diophantine equations on the parameters resulting from the sphere packing conditions. A Lloyd theorem based on the theory of weakly metric association schemes is derived.

2020 Mathematics subject classification: primary 94B25; secondary 05E30.

Keywords and phrases: Homogeneous metric, Perfect code, Lloyd theorem, Weakly metric association schemes.

1. Introduction

The homogeneous metric is one of the most important metrics for codes over rings [10]. It was first introduced over residue class rings in [4], but can be defined, more generally, over quasi-Frobenius rings [9]. Given an alphabet ring, this metric is unique, up to scale, depending only on the lattice of ideals of that ring. When the ring is $Z_4$, the homogeneous weight coincides with the Lee weight and is the Hamming weight of the Gray map in [7]. In this paper we focus on the ring $Z_{2^k}$ for an integer $k \ge 2$. In that special case, the homogeneous weight of a vector over that ring is the Hamming weight of its image by the Carlet's Gray map [3]. The study of perfect codes over that ring was initiated in [11] for $k=2$, and in [12] for general $k$.

In the present paper we study unrestricted perfect codes for the homogeneous
distance. We derive the sphere packing bound, correcting the expression of spheres
volume in [12] (Remark 1). This gives us a Diophantine equation on the parameters of
a perfect code, a fact which yields non-existence results on perfect codes (Theorems 1,
2, 3). Following [13], we develop a necessary existence condition, a "Lloyd theorem"
in analogy to the theorem of that name in metric schemes [6, p.64], especially the
Hamming scheme [5]. To that end, we define an association scheme on $Z_{2^k}$ which is
weakly metric for the homogeneous distance. This scheme could be generalized to
other rings with the homogeneous metric. We expect that the present Lloyd theorem
can give more extensive non-existence results, at the price of more advanced arithmetic
arguments.

<footnote>This research is supported by National Natural Science Foundation of China (12471490).</footnote>
The material is arranged as follows. Section 2 collects the notions on codes, homogeneous weight, Gray map and association schemes needed for the other sections. Section 3 studies the Diophantine equation on perfect codes parameters. Section 4 derives the Lloyd theorem. Section 5 concludes the paper.

## 2. Preliminaries

**2.1. Codes over $\mathbb{Z}_{2^k}$** For any finite set $E$, let $|E|$ denote its cardinality. For any positive integer $m$, let the symbol $[m]$ denote the set $\{1, \dots, m\}$. For any statement $A$, let $\mathbb{1}_A$ denote its indicator function. Let $\mathbb{Z}_{2^k}$ be the ring of integers modulo $2^k$, where $k$ is a positive integer. Let $n$ be a positive integer, and let $\mathbb{Z}_{2^k}^n$ be the set of $n$-tuples over $\mathbb{Z}_{2^k}$. Then $\mathbb{Z}_{2^k}^n$ is a module over $\mathbb{Z}_{2^k}$. $C$ is said to be a linear code with parameters $(n, M)$ if it is a submodule of $\mathbb{Z}_{2^k}^n$ of size $M$. For two vectors $\mathbf{u} = (u_1, \dots, u_n)$ and $\mathbf{v} = (v_1, \dots, v_n) \in \mathbb{Z}_{2^k}^n$, the standard inner product of $\mathbf{u}$ and $\mathbf{v}$ is defined by $\mathbf{u} \cdot \mathbf{v} = u_1 v_1 + \dots + u_n v_n$. In a natural way, the dual of a linear code $C \subseteq \mathbb{Z}_{2^k}^n$ is defined as $C^{\perp} = \{\mathbf{v} \in \mathbb{Z}_{2^k}^n | \mathbf{u} \cdot \mathbf{v} = 0, \forall \mathbf{u} \in C\}$.

**2.2. Homogeneous weight and Gray map** The homogeneous weight of $x \in \mathbb{Z}_{2^k}$ is given by

$$ W_{\text{hom}}(x) = \begin{cases} 0, & \text{if } x = \mathbf{0}, \\ 2^{k-2}, & \text{if } x \notin 2^{k-1}\mathbb{Z}_{2^k}, \\ 2^{k-1}, & \text{if } x \in 2^{k-1}\mathbb{Z}_{2^k} \setminus \{\mathbf{0}\}. \end{cases} $$

Given two vectors $\mathbf{x} = (x_1, \dots, x_n)$, $\mathbf{y} = (y_1, \dots, y_n) \in \mathbb{Z}_{2^k}^n$, the homogeneous distance $d_{\text{hom}}$ on $\mathbb{Z}_{2^k}^n$ is defined by the standard way from the above homogeneous weight $d_{\text{hom}}((x_1, \dots, x_n), (y_1, \dots, y_n)) = \sum_{i=1}^n W_{\text{hom}}(y_i - x_i)$.

**Remark 1.** In [12], the volume of the sphere $B_{\text{hom}}(\mathbf{u}, t)$ with center $\mathbf{u}$ and radius $t$ is $|B_{\text{hom}}(\mathbf{u}, t)| = \sum_{i=0}^{t} \binom{n}{i} (2^k - 1)^i$, which is wrong as we think. Let $b_r = |\{\mathbf{u} \in \mathbb{Z}_{2^k}^n | d_{\text{hom}}(\mathbf{u}, \mathbf{0}) = r\}|$. Then $|B_{\text{hom}}(\mathbf{u}, t)| = \sum_r b_r$, where $b_r = b_{2^{k-2}, i}$, $0 \le r \le t = 2^{k-2} \cdot t'$. According to [3], the Gray map $\varphi$ between $\mathbb{Z}_{2^k}$ and $\mathbb{Z}_2^{2^{k-1}}$ is a map from residues to elements of $\text{RM}(1, k-1)$, and for each element $x$ in $\mathbb{Z}_{2^k}$, its homogeneous weight is equal to the Hamming weight of $\varphi(x)$. Considering that the homogeneous weight of $\mathbf{x} = (x_1, \dots, x_n) \in \mathbb{Z}_{2^k}^n$ is the sum of the homogeneous weight of each coordinate of $\mathbf{x}$, and the weight enumerator of $\text{RM}(1, k-1)$ is $1 + (2^k - 2)x^{2^{k-2}} + x^{2^{k-1}}$, we have the generating function

$$ \sum_r b_r x^r = (1 + (2^k - 2)x^{2^{k-2}} + x^{2^{k-1}})^n. $$

Hence,

$$ b_r = \sum_{s=0}^{\lfloor \frac{i}{2} \rfloor} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s}. $$
Thus,

$$|B_{\text{hom}}(\mathbf{u}, t)| = \sum_{i=0}^{t'} \sum_{s=0}^{\lfloor \frac{i}{2} \rfloor} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s}.$$

A code $C$ over $\mathbb{Z}_{2^k}$ is t-error correcting if the following condition holds: $\forall \mathbf{u}, \mathbf{v} \in C (\mathbf{u} \neq \mathbf{v}) \Rightarrow B_{\text{hom}}(\mathbf{u}, t) \cap B_{\text{hom}}(\mathbf{v}, t) = \emptyset$. If for such a t-error correcting code $C$, the union of these spheres is $\mathbb{Z}_{2^k}^n$, i.e., $\mathbb{Z}_{2^k}^n = \cup_{\mathbf{u} \in C} B_{\text{hom}}(\mathbf{u}, t)$ then the code is said to be perfect. In this situation we have the Diophantine equation $(2^k)^n = 2^{nk} = M(\sum_{r=0}^t b_r)$, where $M$ is the size of the perfect code. Thus $M$ has to be a power of 2. More concretely, for any integer $0 \le c \le nk$, we consider the Diophantine equation $E(c, k, t)$ given by $2^c = \sum_{r=2^{k-2}}^{t} b_r + 1$, where $b_0 = 1$.

**2.3. Association schemes** Let $X$ be a finite set with at least two elements and let $R = \{R_0, R_1, \dots, R_s\}$ be a family of $s + 1$ relations $R_i$ on $X$ for $s \ge 1$.

**Definition 1.** [6] The pair $(X, R)$ will be called an association scheme with $s$ classes if the following three conditions are satisfied:

A1: The set $R$ is a partition of $X^2$ and $R_0$ is the diagonal relation, i.e., $R_0 = \{(x, x) | x \in X\}$.

A2: For $i = 0, 1, \dots, s$, the inverse $R_i^{-1} = \{(y, x) | (x, y) \in R_i\}$ of the relation $R_i$ also belongs to $R$.

A3: For any triple of integers $i, j, k = 0, 1, \dots, s$, there exists a number $p_{ij}^k = p_{ji}^k$ such that, for all $(x, y) \in R_k$: $|\{z \in X \mid (x, z) \in R_i, (z, y) \in R_j\}| = p_{ij}^k$.

Any relation $R_i$ can be described by its adjacency matrix $D_i$ for $i = 0, 1, \dots, s$, which is defined as follows:

$$D_i(x, y) = \begin{cases} 1, & \text{if } (x, y) \in R_i, \\ 0, & \text{if } (x, y) \notin R_i. \end{cases}$$

It is well known that $T = \{\sum_{i=0}^s \alpha_i D_i | \alpha_i \in \mathbb{C}\}$ constitutes a complex algebra called the Bose-Mesner algebra. There are two “natural” bases $\{D_i\}$ and $\{J_i\}$ of the Bose-Mesner algebra of a scheme, where $\{J_i\}_{i \in \{0, 1, \dots, s\}}$ is a unique basis of minimal idempotents which satisfy $J_i^2 = J_i$, $J_i J_j = \mathbf{0}$ ($i \neq j$), $\sum_{i=0}^s J_i = I_{|X|}$, where $I_{|X|}$ is the identity matrix of order $|X|$. We consider the linear transformations from $J_k$ to $D_k$. Firstly, $D_k = \sum_{i=0}^s P_k(i) J_i$, $k = 0, 1, \dots, s$. The complex numbers $P_k(0), P_k(1), \dots, P_k(s)$ are the eigenvalues of $D_k$, which are also called the first eigenvalues of the scheme. The quasi-distance $d$ [13] on $X$ is a mapping from $X^2$ to the nonnegative reals satisfying the triangle inequality. An association scheme $(X, R)$ with $s$ classes is a scheme weakly metric [13] for the quasi-distance $d$, if it is equipped with the quasi-distance $d$ constant on the classes of the scheme: $\forall (a, b) \in X^2$, $aR_i b \Rightarrow d(a, b) = d(i)$, where $i \in \{0, 1, \dots, s\}$. Then the Lloyd polynomial in a weakly metric association scheme
is defined by [13]: $\Psi_r(l) = \sum_{d(k) \le r} P_k(l)$. In a weakly metric scheme $(X, R)$ with quasi-distance $d$, the dispersion function $\Pi$ is defined by $\Pi(j) = |\{i \in \{0, 1, \dots, s\} | d(i) \le j\}|$.

### 3. Diophantine condition

Taking the normalization factor $\gamma = 2^{k-2}$ in the following sections, we obtain a generating function with a simpler form

$$ \sum_i d_i x^i = (1 + (2^k - 2)x + x^2)^n \quad (1) $$

and the equation $E(c, k, t)$ becomes: $2^c = \sum_{i=1}^{t'} d_i + 1$, where $d_i = b_{2^{k-2}, i} = b_r$, $1 \le r \le t = 2^{k-2} \cdot t'$.

**Theorem 1.** There are no 4-error correcting perfect codes of length $n$ in the homogeneous metric over $\mathbb{Z}_8$ for $n > 1$.

**PROOF.** Suppose that $C$ is a 4-error correcting perfect code of parameters $(n, M)$ over $\mathbb{Z}_8$, then the parameters of $C$ must satisfy the equation $E(c, k, t)$ when $t' = 2$. According to the generating function (1), we have

$$ d_i = \sum_{s=0}^{\lfloor \frac{i}{2} \rfloor} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s}, \quad i = 0, 1, \dots, 2n. \quad (2) $$

Then the volume of the sphere of radius 4 in $\mathbb{Z}_8^n$ is

$$ \sum_{i=0}^{2} d_i = 1 + (2^k - 2)n + \frac{1}{2}(2^k - 2)^2 n(n-1) + n = (2n-1)(9n-1). $$

Note that for $n > 1$, $2n - 1$ is an odd number and $2n - 1 \ne 2^l$ for any integer $l$ with $0 \le l \le c$ and $t' = 2 < 2n$. However, the LHS of $E(c, k, t)$ only has divisors of the form $2^l$. Consequently, the parameters of $C$ fail to satisfy the Diophantine condition when $t' = 2$, there are no such 4-error correcting perfect codes $C$ with respect to the homogeneous weight over $\mathbb{Z}_8$ for $n > 1$. $\square$

**Theorem 2.** Let $n$ and $k$ be two positive integers. There are no $2^{k-2} \times 3$-error correcting perfect codes of length $n$ in the homogeneous metric over $\mathbb{Z}_{2^k}$ for $k \ge 2$ if $n$ is even or $n$ is odd and $n \equiv 3 \pmod 4$.

**PROOF.** According to the generating function (1), the volume of the sphere of radius
$2^{k-2} \times 3$ in $\mathbb{Z}_{2^k}^n$ is

$$
\begin{align*}
\sum_{i=0}^{3} d_i &= 1 + \binom{n}{1}(2^k - 2) + \binom{n}{2}(2^k - 2)^2 + \binom{n}{1} + \binom{n}{3}(2^k - 2)^3 + \binom{n-1}{1}(2^k - 2)^4 \\
&= 1 + n + (2^k - 2)n^2 + \frac{(2^k - 2)^2 n(n-1)}{2} + \frac{(2^k - 2)^3 n(n-1)(n-2)}{6} \\
&= 1 + n + 2 \left[ (2^{k-1} - 1)n^2 + (2^{k-1} - 1)^2 n(n-1) \right. \\
&\qquad \left. + \frac{2(2^{k-1} - 1)^3 n(n-1)(n-2)}{3} \right].
\end{align*}
$$

(1) If $n$ is even, then $\sum_{i=0}^{3} d_i > 1$ is odd and $t' = 3 \le 2n$ in this case. The equation $E(c, k, t)$ does not hold in this case, which is a contradiction.

(2) If $n$ is odd. Let $n + 1 = 2^a n_1$, where $n_1$ is odd and $a \ge 1$. One can verify that

$$
\begin{align*}
\sum_{i=0}^{3} d_i &= 2^a n_1 + 2(2^{k-1}-1)n[n+(2^{k-1}-1)(n-1)] + \frac{4(2^{k-1}-1)^3 n(n-1)(n-2)}{3} \\
&= 2 \left[ 2^{a-1} n_1 + \frac{2(2^{k-1}-1)^3 n(n-1)(n-2)}{3} \right. \\
&\qquad \left. + (2^{k-1}-1)n(n+(2^{k-1}-1)(n-1)) \right] = 2b,
\end{align*}
$$

where $b > 1$ is an odd number and $3 < 2n$ under the conditions that $n$ and $n_1$ are odd,
$n \equiv 3 \pmod 4$ and $\frac{n(n-1)(n-2)}{3}$ is an integer, which is a contradiction. The proof of the
second part has been finished. $\square$

The following arithmetic lemma plays a crucial role in the proof of Theorem 3.

**Lemma 1.** [8, Lucas' Theorem] Let $p$ be a prime number, and let $a, b$ be two nonnegative integers, then

$$
\left( \begin{array}{c} pa + r_a \\ pb + r_b \end{array} \right) \equiv \left( \begin{array}{c} a \\ b \end{array} \right) \left( \begin{array}{c} r_a \\ r_b \end{array} \right) (\text{mod } p),
$$

where $r_a, r_b \in \{0, 1, \dots, p-1\}$.

**Theorem 3.** Let $n, k, t'$ and $l$ be positive integers with $k \ge 2$. If $n = 2^l$ then there are no $2^{k-2} \cdot t'$-error correcting perfect codes of length $n$ in the homogeneous metric over $\mathbb{Z}_{2^k}$ for $1 \le t' < 2n$.
**PROOF.** According to the equation $E(c, k, t)$, we have

$$ 
\begin{aligned}
2^c = \sum_{i=0}^{t'} d_i &= 1 + \sum_{i=1}^{t'} \sum_{s=0}^{\lfloor \frac{i}{2} \rfloor} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s} \\
&= 1 + \sum_{i \in [t'], i \text{ odd}} \sum_{s=0}^{\lfloor \frac{i}{2} \rfloor} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s} \\
&\quad + \sum_{i \in [t'], i \text{ even}} \sum_{s=0}^{\frac{i}{2}-1} \binom{n}{s} \binom{n-s}{i-2s} (2^k - 2)^{i-2s} + \sum_{j=1}^{\lfloor \frac{t'}{2} \rfloor} \binom{n}{j}.
\end{aligned}
$$

By Lemma 1, $\binom{n}{j}$ are even for $1 \le j \le \lfloor \frac{t'}{2} \rfloor$ of $n = 2^l$ since $\lfloor \frac{t'}{2} \rfloor < n$. Then $\sum_{i=0}^{t'} d_i > 1$ is odd, which is a contradiction. $\square$

## 4. A Lloyd theorem

In [13], the Lloyd theorem in a weakly metric association scheme is derived by utilizing the Lloyd polynomial and the first eigenvalues of the scheme:

**Lemma 2.** [13, Theorem 2] Let $Y$ be e-error correcting. Then $\Psi_e(l)$ vanishes for at least $\Pi(e) - 1$ values of $l$.

Bariffi et al. [1] introduced a finer partition of the alphabet ring which can be applied to the ring $\mathbb{Z}_{2^k}$: $Z := \{0\}$, $U := \mathbb{Z}_{2^k}^\times$, $S := \{2^{k-1}\}$, $V := \langle 2 \rangle \setminus \langle 2^{k-1} \rangle$. This partition induces an association scheme on $\mathbb{Z}_{2^k}$ with the set of relations $R = \{R_Z, R_U, R_S, R_V\}$ by [14, Lemma]: $xR_I y \Leftrightarrow x - y \in I$, for any $I \in \{Z, U, S, V\}$. Now we consider the extension of length $n$ of the above association scheme:

**Definition 2.** Let $\pi_I(\mathbf{x}) := |\{j = 1, \dots, n \mid x_j \in I\}|$, where $\mathbf{x} = (x_1, \dots, x_n) \in \mathbb{Z}_{2^k}^n$ and $I \in \{Z, U, S, V\}$, and let $D_\pi := \{\pi^{(i)} = (\pi_Z^{(i)}, \pi_U^{(i)}, \pi_S^{(i)}, \pi_V^{(i)}) \mid i = 0, 1, \dots, s\}$. Then we define the weakly metric association scheme on $\mathbb{Z}_{2^k}^n$ with the set of relations $R = \{R_0, R_1, \dots, R_s\}$:

$\mathbf{x}R_I \mathbf{y} \Leftrightarrow \pi(\mathbf{x} - \mathbf{y}) = \pi^{(i)} \in D_\pi$, for any $\mathbf{x}, \mathbf{y} \in \mathbb{Z}_{2^k}^n$ and $i \in \{0, 1, 2, \dots, s\}$, and the quasi-distance $d: \forall (\mathbf{x}, \mathbf{y}) \in (\mathbb{Z}_{2^k}^n)^2$, $\mathbf{x}R_I \mathbf{y} \Leftrightarrow d(\mathbf{x}, \mathbf{y}) = d(i) = \pi_U^{(i)} + \pi_V^{(i)} + 2\pi_S^{(i)}$, where $s = \binom{n+3}{3}$.

For any pair $(\pi, \rho) \in D_\pi^2$, the set of all compositions of $\rho$ with respect to $\pi$ is

$$ \mathrm{Comp}_\pi(\rho) := \left\{ \tau = (\tau_Z, \tau_U, \tau_S, \tau_V) \mid \begin{array}{l} \tau_I = (\tau_{IZ}, \dots, \tau_{IV}) \in \{0, \dots, \pi_i\}^4 \text{ with} \\ \displaystyle\sum_{J \in [Z, U, S, V]} \tau_{IJ} = \pi_I, \sum_{I \in [Z, U, S, V]} \tau_{IJ} = \rho_J, \forall I, J \end{array} \right\} $$
in [1], which is crucial for our main result in this section:

**Theorem 4.** Let $n, k$ and $t'$ be three positive integers with $1 \le t' < 2n$, and let $H := \{\pi = (\pi_Z, \pi_U, \pi_S, \pi_V) \mid \pi \in D_\pi \text{ and } 0 \le \pi_U + \pi_V + 2\pi_S \le t'\}$. If there is a $2^{k-2} \cdot t'$-error correcting perfect code of length $n$ in the homogeneous metric over $\mathbb{Z}_{2^k}^n$ for $k \ge 3$, then the Lloyd polynomial $\Phi_R(\mathbf{x})$

$$ \sum_{\pi \in H} \sum_{\tau \in \text{Comp}_x(\pi)} \left( \prod_{I \in \{Z,U,S,V\}} \binom{x_I}{\tau_{IZ}, \dots, \tau_{IV}} \right) (-1)^{\tau_{US} + \tau_{SU} + \tau_{VV}} 2^{\tau_{VV}} (2^{k-1})^{\tau_{SU} + \tau_{ZU}} (2^{k-1} - 2)^{\tau_{ZV}} f $$

vanishes for at least $\Pi(t') - 1$ values of $\mathbf{x} = (x_Z, x_U, x_S, x_V)$, where the value of $\Pi(t') - 1$ is one of the following two:

(1) If $1 \le t' \le n$, then

$$ \Pi(t') - 1 = \begin{cases} \frac{1}{2} \binom{t' + 4}{3} - \frac{1}{8}(t' + 2)(t' + 4) - 1, & \text{if } t' \text{ is even,} \\ \frac{1}{2} \binom{t' + 3}{3} + \frac{1}{8}(t' + 1)(t' + 3) - 1, & \text{if } t' \text{ is odd.} \end{cases} $$

(2) If $n \le t' \le 2n$, then the value of $\Pi(t') - 1$ is

$$ \left\{ \begin{array}{ll} \binom{n+3}{3} - \frac{1}{2} \binom{2n-t'+2}{3} - \frac{1}{8}(2n-t')(2n-t'+2)-1, & \text{if } t' \text{ is even,} \\ \\ \binom{n+3}{3} - \left( \binom{2n-t'+2}{3} + \frac{1}{2} \binom{2n-t'+1}{3} \right) \\ + \frac{1}{8}(2n-t'-1)(2n-t'+1)-1, & \text{if } t' \text{ is odd.} \end{array} \right. $$

**PROOF.** The proof of this result relies on two steps. First, counting the number of $\pi^{(i)} \in D_\pi$ satisfying $d(i) \le t'$:

(1) If $1 \le t' \le n$, then for any $\pi_S \in \{0, 1, \dots, \lfloor \frac{t'}{2} \rfloor\}$, we have $0 \le \pi_U + \pi_R \le t' - 2\pi_S$. We obtain the result by computing $\sum_{\pi_S=0}^{\lfloor \frac{t'}{2} \rfloor} \sum_{i=1}^{t'-2\pi_S+1} i$.

(2) If $n < t' < 2n$, then $t' - n \le \lfloor \frac{t'}{2} \rfloor$. Although we still have $\pi_S \in \{0, 1, \dots, \lfloor \frac{t'}{2} \rfloor\}$, the maximum value of $\pi_U + \pi_R$ is distinct according to the relation of $\pi_S$ and $t' - n$. When $0 \le \pi_S \le t' - n$, then $0 \le \pi_U + \pi_V \le n - \pi_S$, the corresponding number of $\pi^{(i)}$ is $\sum_{\pi_S=0}^{t'-n} \sum_{j=1}^{n-\pi_S+1} j = \binom{n+3}{3} - \binom{2n-t'+2}{3}$ both for $t'$ being even and odd.

When $t' - n < \pi_S \le \lfloor \frac{t'}{2} \rfloor$, we obtain the result by computing $\sum_{\pi_S=\lfloor \frac{t'}{2} \rfloor}^{\lfloor \frac{t'}{2} \rfloor} \sum_{i=1}^{t'-2\pi_S+1} i$.
By [1, Theorem 30], combined with the general MacWilliams formula for translation association schemes [6, p.88], [2, Thm. 2.10.12,p.71], we obtain that the first eigenvalues of the weakly metric association scheme defined in Definition 2 are

$$ \sum_{\tau \in \text{Comp}_x(\pi)} \left( \prod_{I \in [Z,U,S,V]} \left( \begin{array}{c} x_I \\ \tau_{IZ} \\ \vdots \\ \tau_{IV} \end{array} \right) \right) (-1)^{\tau_{US} + \tau_{SU} + \tau_{VV}} 2^{\tau_{VV}} (2^{k-1})^{\tau_{SU} + \tau_{ZU}} (2^{k-1} - 2)^{\tau_{ZV}} f. \quad (3) $$

By Lemma 2, the proof is finished. □

**Example 1.** Let $n = 2$, $t' = 1$, and $k = 3$. Then $H = \{(2,0,0,0), (1,1,0,0), (1,0,0,1)\}$. For $\pi = (2,0,0,0)$, we have $|\text{Comp}_x(\pi)| = 1$ and the value of Eq. (3) is 1 for any $\mathbf{x} = (x_Z, x_U, x_S, x_V) \in D_\pi$. We focus on $\mathbf{x}$ such that $\tau_{US}, \tau_{SU}, \tau_{VV} \neq 0$ for $\tau \in \text{Comp}_x(\pi)$ (to analyze negative terms in Eq. (3)). There exist 7 such $\mathbf{x}$, but we only detail two critical cases due to similarity: If $\mathbf{x} = (0,0,2,0)$, then $|\text{Comp}_x(\pi)| = 1$ for both $\pi = (1,1,0,0)$ and $\pi = (1,0,0,1)$. The corresponding $\tau$ matrices are

$$ \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix} \text{ and } \begin{pmatrix} 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix}, \text{ respectively, and } \Phi_1(\mathbf{x}) = -5. \text{ If } \mathbf{x} = (1,0,1,0), $$

then $|\text{Comp}_x(\pi)| = 2$ for both $\pi = (1,1,0,0)$ and $\pi = (1,0,0,1)$. The $\tau$ matrices are

$$ \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \end{pmatrix}, \text{ for } \pi = (1,1,0,0), \text{ and } \begin{pmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \end{pmatrix}, \text{ for } \pi = (1,0,0,0). $$

for $\pi = (1,0,0,1)$, with $\Phi_1(\mathbf{x}) = 4$. For other such $\mathbf{x}$, the values of $\Phi_1$ are:

$$ \Phi_1((0, 1, 1, 0)) = -2, \quad \Phi_1((0, 0, 1, 1)) = -4, \quad \Phi_1((0, 0, 0, 2)) = -3, $$

$$ \Phi_1((1, 0, 0, 1)) = 5, \quad \Phi_1((0, 1, 0, 1)) = -1. $$

For all other $\mathbf{x}$, the terms in Eq. (3) are positive. Since $\Pi(1) - 1 = 2$, there exists no 2-error-correcting perfect code of length 2 in the homogeneous metric over $\mathbb{Z}_8$.

## References

[1] J. Bariffi, G. Cavicchioni and V. Weger, 'The existence of MacWilliams-Type Identities for the Lee, Homogeneous and subfield Metric', arXiv:2409.11926, 2024.

[2] A. E. Brouwer, A. M. Cohen and A. Neumaier, 'Distance-Regular Graphs', Springer-Verlag, Berlin, 1989.

[3] C. Carlet, 'Z$_{2^k}$-linear codes', IEEE Trans. Inform. Theory, 1998, 44(4):1543-1547.

[4] I. Constantinescu and W. Heise, 'A metric for codes over residue class rings', Probl. Inf. Transm., 1997, 33(3):22-28.

[5] D. M. Cvetkovic and J. H. van Lint, 'An elementary proof of Lloyd's theorem', Indag. Math., 1977, 80(1):6-10.

[6] P. Delsarte, 'An algebraic approach to the association schemes of coding theory', Philips Res. Rep. Suppl., 1973, 10:1-97.

[7] A. R. Hammons, P. V. Kumar, A. R. Calderbank, N. J. A. Sloane and P. Solé, 'The Z$_4$-linearity of Kerdock, Preparata, Goethals and related codes', IEEE Trans. Inform. Theory, 1994, 40(2):301-319.
[8] É. Lucas, 'Sur les congruences des nombres eulérienset des coefficients differentiels des functions trigonométriques', suivant un module premier, Bulletin de la S. M. F., 1878, 6:49-54.

[9] A. A. Nechaev and T. Khonold, 'Weighted modules and representations of codes', Probl. Inf. Transm., 1999, 35(3):18-39.

[10] M. Shi, A. Alahmadi and P. Solé, 'Codes and Rings: theory and practice', Academic Press, 2017.

[11] V. Şiap and M. Özen, 'On the existence of perfect linear codes over $Z_4$ with respect to homogeneous weight', Appl. Math. Sci., 2012, 6(41):2005-2011.

[12] I. Şiap, M. Özen and V. Şiap, 'On the existence of perfect linear codes over $Z_{2t}$ with respect to Homogeneous metric', Arab. J. Sci. Eng., 2013, 38(8):2189-2192.

[13] P. Solé, 'A Lloyd Theorem in weakly metric association schemes', Europ. J. Combinatorics, 1989, 10(2):189-196.

[14] V. A. Zinoviev and T. Ericson, 'Fourier-invariant pairs of partitions of finite abelian groups and association schemes', Problems Inform. Transmission, 2009, 45(3):221-231.

Jinjiao Xu, Minjia Shi, the Key Laboratory of Intelligent Computing Signal Processing, Ministry of Education, School of Mathematical Sciences, Anhui University, Hefei 230601, P. R. China. xu_jjiao@163.com, smjwcl.good@163.com

Patrick Solé, I2M (Aix Marseille Univ, CNRS, Centrale Marseille), Marseilles, France. sole@enst.fr