# Is a function of $\mathbb N$ known producing only prime numbers?

It is well known that a polynomial $$f(n)=a_0+a_1n+a_2n^2+\cdots+a_kn^k$$ is composite for some number $n$.

What about the function $f(n)=a^n+b$ ?

Do positive integers $a$ and $b$ exists such that $a^n+b$ is prime for every natural number $n\ge 1$ ?

I searched for long chains in order to find out whether there is an obvious upper bound. For example $4^n+4503$ is prime for $n=1,\ldots,14$.

• I think there is no known strictly increasing function producing only prime numbers (and hence arbitrary large prime numbers) other than the Eratosthene sieve or the one extracting all the prime numbers from $a n+1$ or those kind of (very hardly computable) functions. So in general you'd like to prove if there are (or not) an infinity of primes in $f(n)$, but not that it outputs only primes. – reuns May 9 '16 at 22:03
• It is known that there exists a real number $a$ such that the integer part of $a^{3^n}$ is prime for all $n\ge 1$. But since $a$ cannot be completely calculated, this formula does not count. – Peter May 9 '16 at 22:05
• I guess this statement is general for any sequence of integers such that $f(n) \sim n \ln n$ ? – reuns May 9 '16 at 22:20
• Does $a=1, b=p-1$ work? :-) – lhf May 10 '16 at 1:10

The answer to your question is no. For any $a>1,b\geq 1$ there will always exists $n$ such that $a^n+b$ is composite.
Suppose that $a+b$ is prime, (otherwise we are finished) and consider $n=a+b$ and look at $a^{a+b}+b$ modulo $a+b$. Then by Fermat's little theorem, which states that $$a^p\equiv a\pmod{p}$$ for any prime $p$, it follows that $$a^{a+b}+b\equiv a+b\equiv 0\pmod{a+b},$$ and so $a^{a+b}+b$ is divisible by $a+b$ and hence it is composite.
• So, in short, one or both of $n=1$ or $n=a+b$ will give a composite. – Akiva Weinberger May 11 '16 at 13:05