Only finitely many $a, b$ such that $2+3^n+5^{n^2}=2^a7^b$ for some $n$? Let $(a,b)$ be a pair of positive integers such that $$2+3^n+5^{n^2}=2^a7^b$$ for some positive integer $n$. Is it true that there are only finitely many such pairs?
I don't know the answer to such question, but I guess that it is positive..
 A: No positive integer solutions exist to $2+3^n+5^{n^2}=2^a7^b$.
$n$ even $\,\Rightarrow\, 2+3^n+5^{n^2}\equiv 2+(-1)^{n^2}\equiv 2+1\equiv 0\not\equiv 2^a7^b\pmod{\!3}$.   
$n$ odd $\,\Rightarrow\, 2+3^n+5^{n^2}\equiv 2+(-1)^n+1^{n^2}\equiv 2\equiv 2^a7^b\pmod{\!4}$, so $a=1$.    
But $2+3^n+5^{n^2}\equiv 2+(-1)^{n^2}\equiv 1\not\equiv 2\cdot 7^b\equiv 2\cdot 1^b\equiv 2\pmod{\!3}$.
A: I can even prove the stronger claim: There are no triples $(a,b,n)$ that statistify the given equation.
To prove this, we will use Fermat's Little theorem: $$a^p \equiv a \mod p$$ as well as the corollaries:


*

*$a^{p-1} \equiv 1 \mod p$ if $\gcd(a,p)=1$  

*$a^{k(p-1)} \equiv 1 \mod p$ if $\gcd(a,p)=1$. 


Further, we will use Euler's theorem: If $\gcd(a,m)=1$, then $a^{\varphi(m)}\equiv 1 \mod m$ as well as the corollary: $a^{k\varphi(m)}\equiv 1 \mod m$
Starting form here, $a,b,n$ is as in the question. 

If $n=2k$: $$5^{(2k)^2} = 5^{4k^2} = 5^{(3-1)2k^2} \equiv 1 \mod 3$$
Therefore $$5^{(2k)^2}+2+3^{2k} \equiv 3 \equiv 0 \mod 3$$ therefore this can not be a solution since 3 is not a factor of the RHS.

If $n=4k+1$: $$3^{4k} = 3^{(5-1)k} \equiv 1 \mod 5$$ Therefore $$3^{4k+1} \equiv 3 \mod 5$$ and $$3^{4k+1}+2 \equiv 5 \mod 5$$ therefore this can not be a solution since 5 is not a factor of the RHS.

If $n=4k+3$: 
By Euler's theorem: $\varphi(4)=2$, so $$5^{2k} \equiv 1 \mod 4 \text{  and  } 3^{2k} \equiv 1 \mod 4$$ Therefore $3^{4k+3} \equiv 3 \mod 4$ and $5^{4k+3} \equiv 5 \equiv 1 \mod 4$ and $5^{(4k+3)^2} \equiv 1 \mod 4$. 
From this, it follows that $2+3^{4k+3}+5^{(4k+3)^2} \equiv 6 \mod 4$, so 4 is not a divisior of the LHS, so $a=1$ in this case. 
We split this case further in $n=12k+3$, $n=12k+7$ and $n=12k+11$ to show that they aren't divisible by 7.  

If we show it for $n=3$, $n=7$ and $n=11$ we can use Fermats Little theorem to show it for all mentioned $n$. A simple calculation shows that these aren't. 
Therefore, all numbers in the form $n=4k+3$ have only one factor 2 and no factors 7, so the LHS can be at most 2, but it is at least 10. Therefore this class doesn't have any solutions either. This completes the proof. QED
