The code below produces the following output where the elements in the last column are incorrectly placed. Is this easy to fix?
\documentclass{article}
\usepackage{nicematrix}
\ExplSyntaxOn
\NewDocumentCommand\eratosthenes{ m }{
$\AutoNiceMatrix[hvlines, columns-width=auto]{#1-#1}{\cellval{#1}{\arabic{iRow}}{\arabic{jCol}}}$
}
\NewDocumentCommand\cellval{ mmm }{
\int_eval:n{#3 + #1*(#2 - 1)}
}
\ExplSyntaxOff
\begin{document}
\eratosthenes{10}
\end{document}

2023/06/04 v6.20– samcarter_is_at_topanswers.xyz Jun 12 '23 at 10:33nicematrix. I will investigate. – F. Pantigny Jun 12 '23 at 11:08