\section{Integer dilations and the choice of scale}\label{sec:scales} For positive $u,v$ write $P=u+v$, $\beta=1/u+1/v$, $\theta=v/u>1$, and \[ L(T)=\#\{(i,j)\in\Z_{\ge0}^2:ui+vj\le T\},\qquad d(T)=L(T)-\frac{T^2+PT}{2uv}. \] Cristofaro-Gardiner, Li and Stanley \cite[Theorem~1]{cgls} classified irrational-slope triangles whose integer-dilate count is a quasipolynomial. In this notation their condition is that both $\beta$ and $P\beta$ are integers. Hardy and Littlewood \cite{hl} studied the error when $T$ varies continuously. Restricting $T$ to integers makes the scale of the triangle matter. \begin{sourceconj}[Cristofaro-Gardiner, Holm, Mandini and Pires, {\cite[Conjecture~6.14]{cg}}] Suppose $\theta$ is quadratic irrational and $\theta+1/\theta\in\Q$. If the quasipolynomiality condition above fails, then on integer arguments $d(T)$ is $O(\log(2+T))$ and has positive and negative excursions of order $\log T$. \end{sourceconj} The displayed conjecture in \cite{cg} imposes the two hypotheses on the ratio. In the surrounding geometric application the authors have also normalized $P$ to be an integer. The distinction changes the answer. We prove the assertion whenever $P$ is rational and give a counterexample to the formulation allowing arbitrary scales. The example has irrational $P$ and hence does not arise in the normalization of the staircase argument. \begin{theorem}[Rational perimeter]\label{th:ratper} Suppose $\theta$ is irrational, $\theta+\theta^{-1}\in\Q$ and $P\in\Q$. If $\beta,P\beta$ are integers then $d(T)$ is periodic on the nonnegative integers. Otherwise $d(T)$ has excursions of each sign of order $\log T$ there, and $d(T)=O(\log(2+T))$. \end{theorem} \begin{proof} First let $P$ be an integer. The reciprocal axes $x=1/u$, $y=1/v$ are quadratic conjugates since $x+y=\beta=(\theta+\theta^{-1}+2)/P$ and $xy=\beta/P$ are rational. The layer count in the proof of Lemma~\ref{lem:perimeter-divisibility} and \eqref{eq:all-perimeter-residues} hold for these axes. When $\beta\notin\Z$, Theorem~\ref{thm:arithmetic} gives logarithmic excursions of both signs for the sum of the $P$ residue errors. At least one of its $P$ summands has that sign and at least the average magnitude. For each residue the rotation increments are $Px=1+\theta$ and $Py=1+1/\theta$. They have bounded partial quotients. Denjoy--Koksma on the convergent blocks of the Ostrowski expansion gives the logarithmic upper bound. For integral $\beta$, $g(k)=\{kx\}+\{ky\}-1=0$ for $k>0$, giving periodicity. Now let $P=A/B$ in lowest terms and replace $u,v$ by $Bu,Bv$. For the resulting error, $d'(BT)=d(T)$. Along each fixed residue modulo $A$, two consecutive values of $d'(An+r)$ differ by at most one by the layer formula. Since $A,B$ are coprime, a sampled argument divisible by $B$ occurs within $B$ such steps. Both signs and the logarithmic order therefore persist on the sampled arguments. The periodic case restricts to a periodic sequence. For the scaled axes the reciprocal sum is $\beta/B$, an integer exactly when both $\beta$ and $P\beta$ are integers. \end{proof} \medskip \noindent\textbf{A bounded, nonperiodic family.} For each integer $k\ge3$, set \[ \theta=\frac{k+\sqrt{k^2-4}}2,\qquad u=\frac1{\theta-1},\qquad v=\frac{\theta}{\theta-1}, \qquad x=\theta-1 . \] For every nonnegative integer $t$, \[ L(t)=1+(k-2)\binom{t}{2}+\lfloor tx\rfloor,\qquad d(t)=1-\{tx\}. \] In particular $d(t)$ is bounded and has dense range in $[0,1]$ in the sense that its set of values has closure $[0,1]$. \begin{proof} We have $\theta+\theta^{-1}=k$ and $v-u=1$. Translation by the second coordinate vector gives \[ L(t+v)-L(t)=1+\left\lfloor (t+v)/u\right\rfloor. \] Indeed, translation accounts for exactly the lattice points with positive second coordinate, leaving the points on the horizontal axis. Translation by the first coordinate vector, this time starting at $t+1$, likewise gives \[ L(t+v)-L(t+1)=1+\left\lfloor (t+v)/v\right\rfloor . \] Since $1/u=x$, $v/u=x+1$ and $1/v=x-(k-2)$, subtraction at integral $t\ge0$ yields \[ L(t+1)-L(t) =(k-2)t+\lfloor(t+1)x\rfloor-\lfloor tx\rfloor . \] Summation and $L(0)=1$ prove the first formula. For the second, use $1/(uv)=k-2$ and $\beta=2x-(k-2)=\sqrt{k^2-4}$. Irrationality of $x$ implies density of its fractional parts. \end{proof} Here $P\beta=k+2$ is integral, $\beta=\sqrt{k^2-4}$ is irrational, and $P=\sqrt{k^2-4}/(k-2)$ is irrational. In the smallest example $u=\varphi^{-1}$ and $v=\varphi$. It is useful to compare this with the distinct triangle in \cite[Example~1]{cgls}, whose integer count is a polynomial. \subsection*{All bounded cases in the quadratic field} Assume $\tau=\theta+\theta^{-1}\in\Q$ and let $K=\Q(\theta)$. Put $D_\pm=v\pm u$ and $\gamma_\pm=1/u\pm1/v$. \medskip\noindent\begin{theorem}[Axes in the quadratic field] If $u,v\in K$, then $(d(t))_{t\ge1}$ on the integers is bounded if and only if at least one of the following conditions holds. \[ \gamma_+,\,D_+\gamma_+\in\mathbb Z, \qquad\text{or}\qquad \gamma_-,\,D_-\gamma_-\in\mathbb Z . \] \end{theorem} The first condition is the quasipolynomiality condition of Cristofaro-Gardiner, Li and Stanley \cite{cgls}. Both products $D_\pm\gamma_\pm=\tau\pm2$ are rational. In particular, either displayed condition forces $D_\pm$ to be rational for its corresponding sign. \begin{proof} Let $C_t(j)=\sum_{i=1}^j(\{it\}-1/2)$ for nonnegative integers $j$, and extend it to all integers by the difference equation $C_t(j)-C_t(j-1)=\{jt\}-1/2$. For $j>0$ and irrational $t$ one has $C_t(-j)=C_t(j-1)+1/2$. For any integers $m,n$ with $mu+nv\ge0$, translations along the two coordinate axes give \[ d(mu+nv)=1-C_\theta(n)-C_{1/\theta}(m). \] Indeed the successive changes in $d$ on increasing $n$ and $m$ are $1/2-\{(n+1)\theta\}$ and $1/2-\{(m+1)/\theta\}$, respectively. A lattice path from $(0,0)$ to $(m,n)$ can be taken in the allowed half-plane by doing the positive steps first. As $u,v$ form a rational basis for $K$, there are integers $m,n$ and $D>0$ with $mu+nv=D\in\mathbb Z$. Put $a=|n|$, $b=|m|$. If the error is bounded, the preceding identity and the negative-index convention show that $C_\theta(aj)+C_{1/\theta}(bj)$ is bounded for all $j\ge0$. We show that this forces $a=b$. For $a\ne b$ let $q$ be the reduced denominator of $\tau$, set $R x=x+q\theta\bmod1$ and $w(z)=\{z\}-1/2$. On grouping in blocks of $q$, the sums become Birkhoff sums starting at $0$ of \[ g(x)=\sum_{i=1}^{qa}w(ax+i\theta)+ \sum_{i=1}^{qb}w(-bx+i/\theta). \] An empty sum here has value zero. On every continuity interval $g$ is affine of nonzero slope $c=q(a^2-b^2)$. If its sums at $0$ were bounded by $B$, then every sum $g_N=\sum_{j=0}^{N-1}g\circ R^j$ would be bounded by $2B$ on the dense orbit of $0$, hence almost everywhere by piecewise continuity. The Ces\`aro transfer argument gives an $L^1$ function $h$ with $g=h-h\circ R$: indeed the Ces\`aro averages of $g_N$ are bounded in $L^2$ and any weak limit satisfies the claimed equation because $g$ has zero spatial mean. In particular $\|g_N\|_1\to0$ along convergent denominators of $q\theta$. But $g_N$ is affine with slope $Nc$ on at most $C N$ pieces. The integral of the absolute value of an affine function of slope $s$ on an interval of length $\ell$ is at least $|s|\ell^2/4$. Summing and using Cauchy--Schwarz gives $\|g_N\|_1\ge |c|/(4C)$, a contradiction. Consequently $a=b$, which forces either $D_+\in\mathbb Q$ or $D_-\in\mathbb Q$. The rational-perimeter case is covered by Theorem~\ref{th:ratper}. For completeness, consider the other case, $D_-=A/B$ with positive coprime integers $A,B$. Replace $u,v$ by $Bu,Bv$. This changes the error at integer $t$ into the error for the new axes at $Bt$. For the new axes the difference is $A$. The identity along the lattice direction $(-1,1)$ shows on the subsequence $t'=A B j$ that boundedness forces boundedness of $C_\theta(Bj)+C_{1/\theta}(Bj)$. The single-step changes are bounded, so this sum is bounded at every positive integer. Duke's theorem \cite{duke} forces $\tau\in\mathbb Z$. Until the end of this paragraph use the scaled axes and let $\gamma=1/u-1/v$ for those axes. For $0\le r1$ choose $r=1$. For $A=1$, $\gamma=\tau-2$ is already an integer. Conversely, integral $\gamma$ implies boundedness at every residue by the same criterion. Returning to the original axes, the conditions obtained are $\tau-2\in\mathbb Z$ and $\gamma_-/B\in\mathbb Z$. Since $D_-=A/B$ in lowest terms and $D_-\gamma_-=\tau-2$, these are equivalent to $\gamma_-,D_-\gamma_-\in\mathbb Z$. This proves both directions. \end{proof}