The OEIS is supported by the many generous donors to the OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 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. 2
 3, 4, 16, 40, 64, 88, 208, 280, 352, 376, 460, 484, 508, 520, 604, 1012, 1024, 1072, 1168, 1240, 1264, 1336, 1420, 1432, 1444, 1912, 2176, 2212, 2548, 2560, 2632, 2836, 2848, 2872, 2944, 2956, 3184, 3220, 3508, 3616, 3640, 3772, 3868, 3892, 3928, 3940, 3952 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 LINKS Michael De Vlieger, Table of n, a(n) for n = 1..10000 FORMULA A154734(n+1) = k(a(n)) where k(m) = m*(m+1)/2+2*(-1)^m. - R. J. Mathar, Jul 16 2022 EXAMPLE The initial values of k(m) are: k(0) = 2 k(1) = 1-2 = -1 k(2) = 4+1 = 5 k(3) = 9-5 = 4 and both 3 and 5 are primes, so 3 is the first term in the sequence k(4) = 16-4 = 12, and 11 & 13 are primes, so a(2) = 4 and so on - N. J. A. Sloane, Jul 14 2022 MATHEMATICA k=2; lst={}; Do[k=n^2-k; If[PrimeQ[k-1]&&PrimeQ[k+1], AppendTo[lst, n]], {n, 8!}]; lst (* Second program: *) 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 *) PROG (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)}; a154736(5000) \\ Hugo Pfoertner, Jul 14 2022 CROSSREFS Cf. A154734. Sequence in context: A328773 A330693 A329541 * A188114 A188116 A300316 Adjacent sequences: A154733 A154734 A154735 * A154737 A154738 A154739 KEYWORD nonn AUTHOR Vladimir Joseph Stephan Orlovsky, Jan 14 2009 EXTENSIONS Better name from Pontus von Brömssen, Jul 14 2022 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified March 20 22:57 EDT 2023. Contains 361392 sequences. (Running on oeis4.)