TITLE: Does $n \mid 2^{2^n+1}+1$ imply $n \mid 2^{2^{2^n+1}+1}+1$?
QUESTION [11 upvotes]: There are two ways to try to prove this. One is in the title, the other is its de Morgan counterpart: $n \nmid 2^{2^{2^n+1}+1}+1 \implies n \nmid 2^{2^n+1}+1$. Disproving it requires only one example of course.
Tried using $\gcd(2^a+1, 2^b+1) = 2^{\gcd(a, b)}+1$ (where $a$ and $b$ are odd positive integers), stuck on both ends. I figured out that if $n$ divides $2^n+1$ then n divides both $2^{2^n+1}+1$ and $2^{2^{2^n+1}+1}+1$ but this implication doesn't work backwards (e.g. $n=57$).
Would appreciate some help.
EDIT1
Eric's pointer wasn't enough for me. Trying to bump by editing instead of reposting (sorry, not sure how to).
EDIT2
This is not much but might save some time for someone. Using user101140's notation and the $a^n+b^n$ identity
$f(n) = 2^n+1 = 3 \sum\limits_{k=0}^{n-1} (-2)^k$
$f(f(n)) = 3 \sum\limits_{k=0}^{2^n} (-2)^k$
$f(f(f(n))) = 3 \sum\limits_{k=0}^{2^{2^n+1}} (-2)^k$
Also, $n \mid f(n) \implies n \mid f(f(n))$ is due to $n \mid f(n) \implies f(n) \mid f(f(n))$ so the proof might be something along the lines of $n \mid f(f(n)) \implies f(f(n)) \mid f(f(f(n)))$. (Please don't bash me if that's stupid.)

REPLY [3 votes]: My computer found the counterexample $n=520809$.
Interestingly $520809=57\times9137$, but I couldn't find any neat "explanation" for that, nor a natural way that $520809$ would appear.
Other few counterexample are $2343441,  15622617, 15622617...$ Indeed, one can show that there are infinitely many of then since if $n$ works, $f(n)$ also works (since $a|b \Leftrightarrow f(a)|f(b)$)
In case anyone is interested in my python code:

def factor(n): #Factors n, and returns a list with its factors (possibly repeated) in increasing order
 k=2
 v=[]
 while n>1:
  if n%k==0:
   v.append(k)
   n=n/k
  else:
   k=k+1
  if k*k>n:
   v.append(n)
   return v


def phi(n): #Calculates the totient function using the prime factorization
 v=factor(n)
 prod=1
 a=1
 for b in v:
  if b==a:
   prod*=b
  else:
   prod*=b-1
   a=b
 return prod 

def f2(n): # Calculates f(f(n)) mod n
 a=pow(2,n,phi(n))+1
 return (pow(2,a,n)+1)%n

def f3(n): # Calculates f(f(f(n))) mod n
 a=pow(2,n,phi(phi(n)))+1
 b=pow(2,a,phi(n))+1
 return (pow(2,b,n)+1)%n


n=11
while 1: #Tries all odd n
 if f2(n)==0:
  if f3(n)!=0:
   print n
   break
 n=n+2