I was thinking about [this question](https://math.stackexchange.com/q/1508821/19661) 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](http://mathworld.wolfram.com/Subfactorial.html)).


*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?



A conjecture about $\lfloor n!\cdot q/e\rfloor-\,!n\cdot q$
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.


