This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A154734 #19 Jul 18 2022 19:28:51 %S A154734 2,4,12,138,822,2082,3918,21738,39342,62130,70878,106032,117372, %T A154734 129288,135462,182712,512580,524802,575130,682698,769422,799482, %U A154734 893118,1008912,1026030,1043292,1828830,2368578,2447580,3247428,3278082,3465030,4022868,4056978 %N A154734 Define k(0) = 2 and k(m) = m^2-k(m-1) for m >= 1. This is a list of those terms k(m) for which k(m)+1 and k(m)-1 are both in A008578 (primes including 1). %F A154734 k(n) = n*(n+1)/2+2*(-1)^n. - _Peter Luschny_, Jul 14 2022 %p A154734 a := proc(n) local k; k := n*(n - 1)/2 - 2*(-1)^n: %p A154734 if k = 2 or isprime(k - 1) and isprime(k + 1) then k else NULL fi end: %p A154734 seq(a(n), n = 1..1000); # _Peter Luschny_, Jul 14 2022 %t A154734 k=2;lst={k};Do[k=n^2-k;If[PrimeQ[k-1]&&PrimeQ[k+1],AppendTo[lst,k]],{n,8!}];lst %o A154734 (PARI) a154734(upto,k0=2) = {my(k=k0); print1(k,", "); for(n=1, oo, my(kk=n^2-k);if(isprime(k-1) && isprime(k+1), print1(k,", ")); k=kk; if(k>upto, break))}; %o A154734 a154734(5000000) \\ _Hugo Pfoertner_, Jul 14 2022 %Y A154734 Cf. A008578, A154736. %K A154734 nonn %O A154734 1,1 %A A154734 _Vladimir Joseph Stephan Orlovsky_, Jan 14 2009 %E A154734 Better name from _Pontus von Brömssen_, Jul 14 2022