%I #26 Sep 08 2022 08:45:44
%S 7,11,23,109,211,307,1021,4583,42967,297779,1022443,1459811,10781809,
%T 125211211,11673806759,3019843939831,40047392632801,88212019638251209,
%U 444190204424015227,57852556614292865039,9801250757169593701501,64747502900142088755541,619216322498658374863033
%N Primes prime(k) such that prime(k)^2 + prime(k+1)^2 - 1 is a perfect square.
%C An infinite number of solutions exists for a^2 + b^2 - 1 = c^2 over the set of natural numbers a, b, c.
%C If we constrain these to b=a+2, i.e., 2a^2 + 4a + 3 = c^2, the solutions are with a = 1, 11, 69, 407, 2377, ... (The twin prime 11 is also in this sequence here. The solutions can be generated recursively from a(0)=1, m(0)=3 and a(k+1) = 3*a(k) + 2*m(k) + 2, m(k+1) = 4*a(k) + 3*m(k) + 4.)
%C Filtering these solutions for prime pairs a(k) and b(k) would generate the subset of lower twin primes in the sequence.
%C The equivalent procedure can be carried out for other prime gaps 2*d such that prime(k)=a, prime(k+1)=a+2*d, 2*a^2 + 4*a*d + 4*d^2 - 1 = m^2. This decomposes the sequence into classes according to the gap 2*d.
%C a(17) > 5*10^12. - _Donovan Johnson_, May 17 2010
%F {A000040(k): A069484(k)-1 in A000290}.
%e 7^2 + 11^2 - 1 = 13^2.
%e 11^2 + 13^2 - 1 = 17^2.
%e 23^2 + 29^2 - 1 = 37^2.
%e 109^2 + 113^2 - 1 = 157^2.
%e 211^2 + 223^2 - 1 = 307^2.
%e 307^2 + 311^2 - 1 = 19^2*23^2.
%e 1021^2 + 1031^2 - 1 = 1451^2.
%e 4583^2 + 4591^2 - 1 = 13^2*499^2.
%t lst = {}; p = q = 2; While[p < 4000000000, q = NextPrime@ p; If[ IntegerQ[ Sqrt[p^2 + q^2 - 1]], AppendTo[lst, p]; Print@ p]; p = q]; lst (* _Robert G. Wilson v_, May 31 2009 *)
%o (PARI) p=2;forprime(q=3,1e6,if(issquare(q^2+p^2-1),print1(p", "));p=q) \\ _Charles R Greathouse IV_, Nov 06 2014
%o (PARI) is(n)=issquare(n^2+nextprime(n+1)^2-1)&&isprime(n) \\ _Charles R Greathouse IV_, Nov 29 2014
%o (Magma) [n: n in [0..2*10^7] | IsSquare(n^2+NextPrime(n+1)^2-1) and IsPrime(n)]; // _Vincenzo Librandi_, Aug 02 2015
%Y Cf. A050791, A129288, A271050.
%K nonn
%O 1,1
%A Ulrich Krug (leuchtfeuer37(AT)gmx.de), May 01 2009
%E Edited and 4 more terms from _R. J. Mathar_, May 08 2009
%E a(13) from _Robert G. Wilson v_, May 31 2009
%E a(15)-a(16) from _Donovan Johnson_, May 17 2010
%E More terms from _Jinyuan Wang_, Jan 09 2021