Let p be an odd prime where p∣n. Then,
4n+1=(4pn)p+1=(4pn+1)((4pn)p−1−(4pn)p−2+⋯−4pn+1)=(4pn+1)x
where x=(4pn)p−1−(4pn)p−2+⋯−4pn+1>1. So, we have
m4n+1−1=m(4pn+1)x−1=(m4pn+1−1)(m(4pn+1)(x−1)+m(4pn+1)(x−2)+⋯+m4pn+1+1).
Since m4n+1−1 is a prime and x>1, m4pn+1−1=1. Thus, m4pn+1=2, and so m=2 and 4pn+1=1. Therefore, pn+1=0, which is a contradiction. We conclude that n has no odd prime factors, hence is a power of 2.