In the minimal example below, the commented out line does not work. Other lines work correctly. I can't understand what the reason is.
Here is a similar question, but my variable \im takes integer values.
\documentclass[margin=3mm]{standalone} \usepackage{tikz} \usepackage{ifthen} \begin{document} \begin{tikzpicture} \def\m{12} \def\n{13} \foreach \i in {0,...,\m}{\coordinate[label=] (u\i) at (360*\i/\n:1);} \foreach \i in { 0,...,\m}{% \pgfmathMod{\i}{5}\edef\im{\pgfmathresult} \draw[blue] (u\im) circle (0.04); \ifthenelse{\i =0}{ }{\draw[red,fill] (u\i) circle (0.02);} %\ifthenelse{\im=0}{ }{\draw[green,fill] (u\i) circle (0.01);} } \end{tikzpicture} \end{document} 
\pgfmathMod{\i}{5}\pgfmathint{\pgfmathresult}