Find all integers $a$ such that there are infinitely many positive integers $n$ such that $n$ divides $\phi(n)!+a$.
Problem
Source: 2024 Girls in Mathematics Tournament- Level B, Problem 4
Tags: number theory, phi function
27.10.2024 17:55
I claim $a=0,1$ are the only answers. First for $a=1$, any $n=p$ prime works due to Wilson's theorem. Suppose now that there is an $a\ne 1$ such that $n\mid \phi(n)!+a$ infinitely often (i.o.). Notice that if there is an infinite sequence $p_n$ of primes along which $p_n\mid \phi(p_n)!+a$ then $p_n\mid a-1$, forcing $a=1$ by taking $n$ large. Thus, except all but finitely many values, $n$ is composite. If $n$ is a prime power i.o., then setting $n=p^e$ we have $\phi(n)=p^{e-1}(p-1)$ with $e\ge 2$. It is not hard to see that for $p=2$, $2^e\mid (2^{e-1})!$ for $e$ large, and for $p>2$ we have $p^{e-1}(p-1)$ is divisible by $p^{e-1}$ and $p$, so $p^e\mid \varphi(p^e)!$. So, for $a=0$ we have by considering prime powers. Conversely, if $n$ is a prime power i.o. then $a=0$. Next suppose $a\ne 0,1$. Then $n=\textstyle \prod_{1\le i\le L}p_i^{e_i}$ and $L\ge 2$. For any prime $p_i$ with $e_i\ge 2$, notice that there is a $j$ such that $p_j-1\ge 2$ so $p_i^{e_i-1}(p_j-1)\ge p_i^{e_i-1}\ge p_i$, forcing $p_i^{e_i}\mid \varphi(n)!$. Furthermore, if $e_i=1$ then if there is a prime $p_j$ with $e_j\ge 2$, we are once again done as $(p_i-1)p_j^{e_j-1}>p_i$. Lastly, suppose $n=p_1\cdots p_L$ where $p_1<\cdots<p_L$ are primes. If $L\ge 3$ then it is easy to see $p_L<\varphi(n)$, so $n\mid \varphi(n)!$ again. The only case that remains is $L=2$ and $n=2p$. In this case, $\phi(n)=p-1$. We show $n\mid \phi(n)+a$ is impossible. On the one hand, $2\mid (p-1)!+a$, forcing $a$ to be even. On the other hand, $p\mid (p-1)!+a$, forcing $a=1$. A contradiction is reached.