TITLE: Pattern of divisibility within $2^n+1\equiv0\pmod{n}$
QUESTION [8 upvotes]: In recent days, I have been studying:the properties of $m^n+h\equiv0\pmod n$ where $m,n\in\mathbb{N}$ and $h\in\mathbb{Z}$, and I am trying to calculate all solutions for $2^n+1\equiv0\pmod n$ for all $n\leq10^{15}$.
Obviously, if one were to calculate the solutions by checking the numbers one by one, it would have taken an extremely long amount of time to do so. Therefore, I have tried to reduce the numbers needed to check by finding the divisibility patterns within the solutions.
From Proposition 3 of the paper "Primitive solutions of $n|2^n+1$", if $n$ is not a power of $3$ and $n=3^kq$ where $k\in\mathbb{Z}$, $k\geq0$, $k|2^k+1$ and $q\neq1$(In other words, $3^k|n$ and $n\neq3^k$), then $q$ is also divisible by one of the primes $p$ such that $p|2^{3^k}+1$. For example, if $81|n$ and $n\neq81$, then one of {$243,1539,13203,7064091,10970073,22032887841$} divides $n$.
However, I have also noticed that the same argument seems to be true for some other divisors. An example is that if $171|n$ and $n\neq171$, then it seems that one of {$513,3249,97641,29884473,27439598619,3279345384337785847895810090688081$} divides $n$.
Is it true for all divisors, and how can I prove it?
References:
Toby Bailey and Christopher J. Smyth (2008). Primitive solutions of $n|2^n+1$,  https://www.maths.ed.ac.uk/~chris/papers/n_divides_2to_nplus1.pdf

REPLY [3 votes]: Using the idea of the proof of Proposition 3, we have the following :
If $n$ is of the form $mN^k$ where $k$ is a positive integer, and $N$ is a prime, and $m\ (\gt 1)$ is an integer satisfying $\gcd(m,N)=1$, then $n$ is divisible by a prime $p$ such that $p|2^{N^{k}\gcd(m,\frac{N-1}{2})}+1$.
The proof is written at the end of the answer.
Letting $N=19$, we have the following :
If $n$ is of the form $m\cdot 19^k$ where $k$ is a positive integer, and $m\ (\gt 1)$ is a positive integer satisfying $\gcd(m,19)=1$, then $n$ is divisible by a prime $p$ such that $p|2^{9\cdot 19^{k}}+1$.
(Since the paper shows that if $n\gt 3$, then $9|n$, we have $\gcd(m,\frac{19-1}{2})=9$.)
The prime factorization of $2^{9\cdot 19^1}+1$ is given by
$$2^{9\cdot 19^1}+1$$
$$=3^3×19^2×571×174763×160465489×19177458387940268116349766612211$$
So, we can say that if $171|n$ and $n\not=171$, then $n$ is divisible by at least one of
$$513\ (=3^3\times 19)$$
$$3249\ (=3^2\times 19^2)$$
$$97641\ (=3^2\times 19\times 571)$$
$$29884473\ (=3^2\times 19\times 174763)$$
$$27439598619\ (=3^2\times 19\times 160465489)$$
$$3279345384337785847895810090688081\ (=3^2\times 19\times 19177458387940268116349766612211)$$

Finally, let us prove the following :
If $n$ is of the form $mN^k$ where $k$ is a positive integer, and $N$ is a prime, and $m\ (\gt 1)$ is an integer satisfying $\gcd(m,N)=1$, then $n$ is divisible by a prime $p$ such that $p|2^{N^{k}\gcd(m,\frac{N-1}{2})}+1$.
Proof : Let $p$ be a prime such that $p|m$. Then $2^{2n}\equiv 1\pmod{pN^k},2^{(p-1)(N-1)N^{k-1}}\equiv 1 \pmod{pN^k}$ (Euler’s Theorem), so $2^{2\gcd(n,\ (p-1)\frac{N-1}{2}N^{k-1}\ )} \equiv 1 \pmod{pN^k}$,$$2^{2N^{k−1}\ \gcd(mN,\ (p-1)\frac{N-1}{2})}\equiv 1 \pmod p.$$ Now, we have $\gcd(mN, (p-1)\frac{N-1}{2})=\gcd(m,\frac{N-1}{2})$ or $N\gcd(m,\frac{N-1}{2})$. If $\gcd(mN, (p-1)\frac{N-1}{2})=\gcd(m,\frac{N-1}{2})$, then we get $2^{2N^{k−1}\gcd(m,\frac{N-1}{2})}\equiv 1 \pmod p.$ If $\gcd(mN, (p-1)\frac{N-1}{2})= N\gcd(m,\frac{N-1}{2})$, then we get $2^{2N^{k}\gcd(m,\frac{N-1}{2})}\equiv 1 \pmod p$, so the latter congruence certainly holds. So, we have $(2^{N^{k}\gcd(m,\frac{N-1}{2})}+1)(2^{N^{k}\gcd(m,\frac{N-1}{2})}-1)\equiv 0\pmod p$. Since $2^{N^{k}\gcd(m,\frac{N-1}{2})}-1\not\equiv 0 \pmod p$, we have $2^{N^{k}\gcd(m,\frac{N-1}{2})}+1\equiv 0\pmod p$.$\quad\blacksquare$