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 A154736 #27 Jul 18 2022 19:29:07 %S A154736 3,4,16,40,64,88,208,280,352,376,460,484,508,520,604,1012,1024,1072, %T A154736 1168,1240,1264,1336,1420,1432,1444,1912,2176,2212,2548,2560,2632, %U A154736 2836,2848,2872,2944,2956,3184,3220,3508,3616,3640,3772,3868,3892,3928,3940,3952 %N A154736 Define k(0) = 2 and k(m) = m^2-k(m-1) for m >= 1. This is a list of those m for which k(m)+1 and k(m)-1 are both prime. %H A154736 Michael De Vlieger, <a href="/A154736/b154736.txt">Table of n, a(n) for n = 1..10000</a> %F A154736 A154734(n+1) = k(a(n)) where k(m) = m*(m+1)/2+2*(-1)^m. - _R. J. Mathar_, Jul 16 2022 %e A154736 The initial values of k(m) are: %e A154736 k(0) = 2 %e A154736 k(1) = 1-2 = -1 %e A154736 k(2) = 4+1 = 5 %e A154736 k(3) = 9-5 = 4 and both 3 and 5 are primes, so 3 is the first term in the sequence %e A154736 k(4) = 16-4 = 12, and 11 & 13 are primes, so a(2) = 4 %e A154736 and so on - _N. J. A. Sloane_, Jul 14 2022 %t A154736 k=2;lst={};Do[k=n^2-k;If[PrimeQ[k-1]&&PrimeQ[k+1],AppendTo[lst,n]],{n,8!}];lst %t A154736 (* Second program: *) %t A154736 k = 2; Reap[Do[Set[k, m^2 - k]; If[AllTrue[k + {-1, 1}, PrimeQ], Sow[m]], {m, 4000}]][[-1, -1]] (* _Michael De Vlieger_, Jul 14 2022 *) %o A154736 (PARI) a154736(upto,k0=2) = {my(k=k0); for(n=1, upto, my(kk=n^2-k); if(isprime(kk-1) && isprime(kk+1), print1(n,", ")); k=kk)}; %o A154736 a154736(5000) \\ _Hugo Pfoertner_, Jul 14 2022 %Y A154736 Cf. A154734. %K A154736 nonn %O A154736 1,1 %A A154736 _Vladimir Joseph Stephan Orlovsky_, Jan 14 2009 %E A154736 Better name from _Pontus von Brömssen_, Jul 14 2022