TITLE: Prove that there are no composite integers $n=am+1$ such that $m \ | \ \phi(n)$
QUESTION [23 upvotes]: Let $n=am+1$ where $a $ and $m>1$ are positive integers and let $p$ be the least prime divisor of $m$. Prove that if $a<p$ and $ m \ | \ \phi(n)$ then $n$ is prime.
This question is a generalisation of the question at
Let $n=apq+1$. Prove that if $pq \ | \ \phi(n)$ then $n$ is prime..
Here the special case when $m$ is a product of two distinct odd primes has been proven. The case when $m$ is a prime power has also been proven here https://arxiv.org/abs/2005.02327.
How do we prove that the proposition holds for an arbitrary positive integer integer $m>1 $? ( I have not found any counter - examples).
Note that if $n=am+1$ is prime, we have $\phi(n)= n-1=am$. We see that $m  \ | \ \phi(n) $. Its the converse of this statement that we want to prove i.e. If $m  \ | \ \phi(n) $ then $n$ is prime.
If this conjecture is true, then we have the following theorem which is a generalisation  ( an extension) of Lucas's converse of Fermat's little theorem.
$\textbf {Theorem} \ \  1.$$ \ \ \ $   Let $n=am+1$, where $a$ and $m>1$ are positive integers and let $p$ be the least prime divisor of $m$ with $a<p$. If for each prime $q_i$ dividing $m$, there exists an integer $b_i$ such that ${b_i}^{n-1}\equiv 1\ (\mathrm{mod}\ n)$ and ${b_i}^{(n-1)/q_i} \not \equiv 1(\mathrm{mod}\ n)$ then $n$ is prime.
Proof. $ \ \ \ $  We begin by noting that ${\mathrm{ord}}_nb_i\ |\ n-1$. Let $m={q_1}^{a_1}{q_2}^{a_2}\dots {q_k}^{a_k}$ be the prime power factorization of $m$. The combination of ${\mathrm{ord}}_nb_i\ |\ n-1$ and ${\mathrm{ord}}_nb_i\ \nmid (n-1)/q_i$ implies ${q_i}^{a_i}\ |\ {\mathrm{ord}}_nb_i$. $ \ \ $${\mathrm{ord}}_nb_i\ |\ \phi (n)$  therefore for each $i$, ${q_i}^{a_i}\ |\ \phi (n)$ hence $m\ |\ \phi (n)$. Assuming the above  conjecture is true, we conclude that $n$ is prime.
Taking $a=1$, $m=n-1$ and $p=2$, we obtain Lucas's converse of Fermat's little theorem. Theorem 1 is thus  a generalisation (an extension) of Lucas's converse of Fermat's little theorem.
On recommendation by the users, this question has been asked on the MathOverflow site,
https://mathoverflow.net/questions/373497/prove-that-there-are-no-composite-integers-n-am1-such-that-m-phin

REPLY [3 votes]: Introduction
First, let the prime factorization of $m$ and $n=am+1$ be:
$$m=\prod_{i=1}^k p_i^{a_i} \quad \quad \quad n=\prod_{i=1}^l q_i^{b_i}$$
where $p_1$ is the least prime factor of $m$. Since $\gcd(m,am+1)=1$, all $p_i$'s and $q_i$'s are pairwise distinct. Using this, we have:
$$m \mid \phi(n) \implies \prod_{i=1}^k p_i^{a_i} \mid \prod_{i=1}^l(q_j-1)q_j^{b_j-1} \implies \prod_{i=1}^k p_i^{a_i} \mid \prod_{i=1}^l(q_i-1)$$
If there exists a prime $q_j>p_1$ such that $\gcd(m,q_j-1)$, then we would have:
$$\phi(am+1) \geqslant \prod_{i=1}^k (q_i-1) \geqslant (q_j-1)m \geqslant p_1m$$
which is a contradiction. We also arrive at a similar contradiction if we assume that $b_j>1$ for any $q_j>p_1$. Thus, we can conclude that:
$$am+1=M\prod_{i=1}^s r_i$$
where $r_i>p_1$ are primes and $M$ has all prime factors less than $p_1$. As we know that $m \mid \prod (r_i-1)$, it follows that we have $am+1 > Mm$. Thus, $p_1 > a \geqslant M$. If there exists a prime $p_j \mid m$, such that $p_j^{a_j+1} \mid \phi(n)$, then:
$$\phi(am+1) \geqslant p_jm \geqslant p_1m > am+1$$
which is obviously a contradiction. Thus, we must have $p_j^{a_j} \mid \mid \phi(n)$ and as a consequence, $s \leqslant \sum a_i$. We can solve particular cases using these facts.

The case $m=p^t$
When $m$ is a perfect prime power, we can take $m$ to be odd. We must have $r_i \equiv 1 \pmod{p}$. We know that we have $p^t \mid \mid \prod (r_i-1)$. The equation becomes:
$$ap^t+1 = M\prod_{i=1}^s r_i \implies M \equiv 1 \pmod{p}$$
Since $M<p$ this forces $M=1$. Next, we can write $r_i=p^{b_i}Q_i+1$ where $p \nmid Q_i$. We know that $\sum b_i = t$.
$$ap^t+1 = \prod_{i=1}^s (p^{b_i}Q_i+1) \implies ap^t > p^t \cdot \prod Q_i \implies a > \prod_{i=1}^s Q_i$$
The strict inequality is ensured since $s>1$ i.e. $n$ is not prime. WLOG assume $b_1 \leqslant b_2 \leqslant \cdots \leqslant b_s$. Let $c=b_1=b_2=\cdots = b_x<b_{x+1}$. Taking the equation modulo $p^{c+1}$ gives:
$$p^c\sum_{i=1}^x Q_i \equiv 0 \pmod{p^{c+1}} \implies p \mid \sum_{i=1}^x Q_i \implies \sum_{i=1}^x Q_i>a>\prod_{i=1}^x Q_i$$
However, since all $r_i$ are odd, all $Q_i$ must be even (since $p$ is odd). This would yield a contradiction since all $Q_i > 1$ and thus, the above inequality of sum being greater than product cannot hold. Thus, $n$ cannot be composite.

The case $m=pq$
Subcase $1$ : $s=1$
$$apq+1=Mr$$
Since $pq \mid (r-1)$, we have $M \equiv 1 \pmod{pq}$ and thus, $M=1$. However, this gives $n=Mr=r$ which is prime.
Subcase $2$ : $s=2$
$$apq+1=Mr_1r_2$$
Let $p \mid (r_1-1)$ and $q \mid (r_2-1)$. Moreover, let $p<q$. Writing $r_1=pQ_1+1$ and $r_2=qQ_2+1$ gives:
$$apq+1=M(pqQ_1Q_2+pQ_1+qQ_2+1) \implies (a-MQ_1Q_2)pq+1=M(pQ_1+qQ_2+1)$$
Since the RHS is positive, this gives $a-MQ_1Q_2 \geqslant 1$. We have:
$$pq < MQ_1Q_2 \bigg(\frac{p}{Q_2}+\frac{q}{Q_1}+\frac{1}{Q_1Q_2}\bigg) \implies q < \frac{p+1}{Q_2}+\frac{q}{Q_1} < \frac{q}{Q_1}+\frac{q}{Q_2} \leqslant q$$
This is a contradiction. Thus, $n$ cannot be composite.