OFFSET
1,1
COMMENTS
These numbers are of the form 3n+1. This follows from the fact that a lower twin prime > 3 is of the form 3n+2. If p1 = 3n+1 then the upper twin would be 3n+1+2 = 3k which is not prime for k > 1. 4 is the only square which is a lower twin prime + 1. If a lower twin prime p1 + 1 is a square, then it is of the form 3n+2+1 or 3n. Then 3n = x^2 implies x = 3r for some r. This implies 3n = 9r^2. Now if we subtract 1 we have 9r^2-1 = (3r-1)(3r+1) which is not prime.
FORMULA
a(n) = A080149(n)^2. [From Ray Chandler, Oct 24 2008]
EXAMPLE
p1=5 is a lower twin prime. 5-1 = 4 is a square.
MATHEMATICA
Select[Select[Partition[Prime[Range[112000]], 2, 1], #[[2]]-#[[1]]==2&][[All, 1]]-1, IntegerQ[Sqrt[#]]&] (* Harvey P. Dale, Jul 05 2020 *)
PROG
(PARI) g(n) = for(x=1, n, y=twinl(x)-1; if(issquare(y), print1(y", ")))
twinl(n) = local(c, x); c=0; x=1; while(c<n, if(ispseudoprime(prime(x)+2), c++);
x++; ); return(prime(x-1))
CROSSREFS
KEYWORD
nonn
AUTHOR
Cino Hilliard, Oct 20 2008
EXTENSIONS
Extended by Ray Chandler, Oct 24 2008
STATUS
approved