OFFSET
1,1
COMMENTS
If the condition holds, prime(k-1) and prime(k) are twin primes. These are of the form 10m+9 and 10m+1. I.e., the last digits are 9 and 1. This is true because a square number must end in 0,1,4,5,6,9. So prime(k-1)+7 is square => it must end in one of these numbers. So to find the ending of prime(k-1), we subtract 7 from 0,1,4,5,6,9 to get the last digit, i.e., 3,4,7,8,9,2.
Since prime(k-1) is prime, endings 2,4,5,8 are not allowed. This leaves us with 3,7,9 as possible endings of prime(k-1). Now to get prime(k), which the condition states is 2 greater than prime(k-1), we add 2 and 3+2=5 => prime(k) not prime, impossible. So the possible endings of prime(k-1) are reduced to 7 or 9. Now the condition prime(k-1)+7 = prime(k+1)-1 => prime(k-1)+8 = prime(k+1). Then adding 7 => prime(k+1) ends in 5, impossible. So prime(k-1) must end in 9, and adding 2 makes prime(k) end in 1. This sequence is a calculation of the conjecture provided in the link. The PARI script provides for the general investigation of numbers of the form prime(k-1)+a and prime(k+1)-b. The values a=5,7; b=1 consistently yield twin primes when the condition holds.
Notice we test for square of the first prime(k-1) retrieval before calling the second prime(k+1). This cuts the search time in half. A far superior search routine is the C program found in the link, which reads a huge 300 GB file of the primes < 1 trillion + 1 billion.
LINKS
Cino Hilliard, C program (broken link) [From Cino Hilliard, Mar 21 2009]
S. M. Ruiz, Integer equal
Sebastian Martin Ruiz and others, Integers then Equals, digest of 7 messages in primenumbers Yahoo group, Mar 14 - Mar 20, 2009.
Zak Seidov, A158470 First 100 terms
EXAMPLE
For k=11, prime(11-1) = 29, 29+7 = 36 = prime(11+1)-1 = 37-1 so 11 is the first entry in the sequence.
MATHEMATICA
pnsQ[n_]:=Module[{p1=Prime[n-1], p2=Prime[n+1]}, p1+7==p2-1&&IntegerQ[ Sqrt[ p1+7]]]; Select[Range[5, 25660000], pnsQ]
PROG
(PARI) integerequal(m, n, a, b) =
{
local(x, p1, p2);
for(x=m, n,
p1=prime(x-1);
if(issquare(p1+a),
p2=prime(x+1); if((p1+a)==(p2-b),
print(x", "p1", "prime(x))
)
)
)
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Mar 19 2009
EXTENSIONS
More terms from Zak Seidov, Mar 20 2009
Offset corrected by Mohammed Yaseen, Jul 19 2023
STATUS
approved