For all $m$ there exist $n$ s.t. both $3^in\pm2$ are primes for all $i<m$?
I came up with the following question with a game. The game says:
Start with an odd number $n$ greater than 3. In each turn, check if its adjecent odd numbers are primes. If the left one is a prime, the add it to $n$, or take it away from $n$. So does the right one.
And that means:
- $n\pm2\text{ are both primes}\iff n\to3n$
- $n+2\text{ is a prime and }n-2\text{ is not a prime}\iff n\to n+4$
- $n+2\text{ is not a prime and }n-2\text{ is a prime}\iff n\to n-4$
- $n\pm2\text{ are neither primes}\iff n\to-2n\text{, that means the game ended}$
If $n$ is the mutiple of 3, $n>3$ so $n$ and $n\pm6$are't primes. And if one of $n\pm2$ is prime, for example, $n+2$, Then the game would be like: $n\to n+4\to n\to n+4\to\cdots$. That means if $n$ escapes tripling, it will be in the above loop.
I want to know the biggest ratio between the initial $n$ and the biggist $n$ it can reach. That might be: $n\to n+4\to3(n+4)\to3^2(n+4)\to3^3(n+4)\to\cdots\to3^m(n+4)\to3^m(n+4)+4$. That means, for $i=0,1,2,3,\cdots,n-1$,$3^i(n+4)\pm2$ should be prime. Let $n^\prime=n+4$,And that's the question I ask.
With the help of the following Python program, I can know the smallest $n$ for $m=3$ is $5$, and the smallest $n$ for $m=4$ is $1547805$. I wondered if there exist $n$ for any $m$ beyond $4$.
def isprime(x):
for i in range(2, int(x ** 0.5) + 2):
if x % i == 0:
return False
return True
a = 0
i = 5
while True:
j = i
b = 0
while True:
if not isprime(j - 2) or not isprime(j + 2):
break
j *= 3
b += 1
if a < b:
a = b
print(i, b)
i += 2
Assuming Schinzel's hypothesis H (a widely believed conjecture), there does exist such an $n$ for any given $m$. Proof: given $m$, consider the polynomials \begin{align*} f_1(x) & = x-2, \\ f_2(x) & = x+2, \\ f_3(x) & = 3x-2, \\ f_4(x) & = 3x+2, \\ & \vdots \\ f_{2m+1}(x) & = 3^m x-2, \text{and} \\ f_{2m+2}(x) & = 3^m x+2. \end{align*} They're all irreducible (since they're linear), and they have positive leading coefficients. Moreover, I claim there is no single prime $p$ with the property that for all $n \in \mathbb Z$, $p$ divides one of the $f_i(n)$. Indeed, if $p$ is odd, then it doesn't divide any of the $f_i(0) = \pm 2$; if $p = 2$, then it doesn't divide any of the $f_i(1)$.
According to Schinzel's hypothesis H, then, there should be infinitely many $n \in \mathbb Z$ such that all of the $f_i(n)$ are prime.
Having said that, we definitely can't prove this unconditionally at our current state of knowledge, since (as was pointed out in the comments) it would imply the existence of infinitely many pairs of cousin primes.