Missing number, treated as zero for a \loop ... \repeat
You use \value
at the wrong place. You need to use it in the second argument of \addtocounter
rather than in \alph
. (I commented out the packages that are not directly related to the problem.)
\documentclass{article}
% \usepackage[utf8]{inputenc}
% \usepackage[english, russian]{babel}
% \usepackage{amsmath}
\begin{document}
\newcounter{n}
\newcounter{k}
\setcounter{k}{1}
\setcounter{n}{0}
\loop
\alph{n}
\addtocounter{n}{\number\value{k}}
\ifnum \value{n} < 26 \repeat
Or without spurious spaces:
\setcounter{n}{0}%
\loop%
\alph{n}%
\addtocounter{n}{\number\value{k}}%
\ifnum\value{n}<26\repeat
\end{document}
The command \alph
takes as argument a counter's name, so \alph{\value{n}}
is incorrect and should be \alph{n}
.
The command \addtocounter
takes two arguments; the first argument is the name of the counter LaTeX should act on, the second argument should be an integer (in any possible denotation); if you want to increment counter n
by 31, you can do
\addtocounter{n}{31}
\addtocounter{n}{"1F} % hexadecimal
\addtocounter{n}{'37} % octal
\addtocounter{n}{\value{mycounter}}
provided mycounter
currently stores 31. The second argument cannot contain just a counter's name.
So you have two calls wrong: \alph{\value{n}}
(watch out for spaces) should be \alph{n}
, whereas \addtocounter{n}{k}
should be \addtocounter{n}{\value{k}}
.
You also have spurious spaces and the order wrong (you won't get z
):
\setcounter{k}{1}
\setcounter{n}{0}
\loop
\ifnum\value{n} < 26
\addtocounter{n}{\value{k}}% <--- needed
\alph{n}% <--- needed
\repeat