TITLE: A conjecture about $\lfloor n!\cdot q/e\rfloor-\,!n\cdot q$
QUESTION [14 upvotes]: I was thinking about this question asked at Math.SE, when I came up with the following conjecture.
For every $q\in\mathbb Q$ consider a sequence $s_n^{(q)}$ (terms within the sequence are indexed by $n\in\mathbb N$):
$$s_n^{(q)}=\left\lfloor\frac{n!\cdot q}e\right\rfloor-\,!n\cdot q$$
($!n$ denotes the subfactorial).
Conjecture: For every $q$ the sequence $s_n^{(q)}$ is periodic. Furthemore, if $q$ is a positive integer is a reciprocal of a positive integer $m$, then the period is:
$$p_{1/m}=\begin{cases}m,\quad m\text{ is even}\\2m,\quad m\text{ is odd}\end{cases}$$
Could you suggest any ideas how to prove this conjecture?

REPLY [7 votes]: Write
$$
\frac{n!\,e^{-1}}m=x_n+\frac{(-1)^{n+m+1}y_n}m+\frac{(-1)^{n+1}\delta_n}m
\qquad\text{and}\qquad
\frac{!n}m=x_n+\frac{(-1)^{n+m+1}y_n}m,
$$
where
$$
x_n=\frac{n!}{m\cdot(n-m)!}\cdot(n-m)!\sum_{k=0}^{n-m}\frac{(-1)^k}{k!}\in\mathbb Z,
\\
y_n=n!\sum_{k=n-m+1}^n\frac{(-1)^{k-(n-m+1)}}{k!}\in\mathbb Z,
$$
and
$$
\delta_n=\frac1{n+1}\biggl(1-\frac1{n+2}+\frac1{(n+2)(n+3)}-\dotsb\biggr)
$$
satisfies $0<\delta_n<1$ (even this rough estimate is sufficient). Note that
$$
y_n=n(n-1)\dotsb(n-m+1)-n(n-1)\dotsb(n-m+2)+\dotsb+(-1)^{m-1}
$$
is $m$-periodic modulo $m$, because each factor in each term of the latter sum is;
in other words, $\{y_n/m\}$ (the fractional part) is periodic with period $m$. It remains to observe that
$$
\biggl\lfloor\frac{n!\,e^{-1}}m\biggr\rfloor-\biggl\lfloor\frac{!n}m\biggr\rfloor
=\biggl\lfloor\frac{(-1)^{n+m+1}(y_n+(-1)^m\delta_n)}m\biggr\rfloor-\frac{(-1)^{n+m+1}y_n}m
$$
and that
$$
\biggl\lfloor\frac{\pm(y_n+(-1)^m\delta_n)}m\biggr\rfloor
=\biggl\lfloor\frac{\pm y_n}m\biggr\rfloor \quad\text{or}\quad \biggl\lfloor\frac{\pm(y_n-1)}m\biggr\rfloor,
$$
respectively, depending on whether $m$ is even or odd. The above argument works for $1/m$ replaced with $\ell/m$,
though to guarantee the estimate for $\delta_n$ one needs $|\ell|\ge n$, so that the periodicity will be eventual;
the period can double if $\ell<0$.
Proving that $m$ or $2m$ is the minimal period is equivalent to showing that the $m$ residues $(-1)^{m-1}y_0,(-1)^{m-1}y_1,\dots,(-1)^{m-1}y_{m-1}$
are not periodic modulo $m$:
$$
(-1)^{m-1}y_0=1, \quad (-1)^{m-1}y_1=1-1, \quad \ldots, \\
(-1)^{m-1}y_k=1-k+k(k-1)-k(k-1)(k-2)+\dots+(-1)^kk!\,, \quad \ldots
$$
This seems to be correct but the distribution of those residues modulo $m$ is quite chaotic.