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

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 2
2, 4, 12, 138, 822, 2082, 3918, 21738, 39342, 62130, 70878, 106032, 117372, 129288, 135462, 182712, 512580, 524802, 575130, 682698, 769422, 799482, 893118, 1008912, 1026030, 1043292, 1828830, 2368578, 2447580, 3247428, 3278082, 3465030, 4022868, 4056978 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
FORMULA
k(n) = n*(n+1)/2+2*(-1)^n. - Peter Luschny, Jul 14 2022
MAPLE
a := proc(n) local k; k := n*(n - 1)/2 - 2*(-1)^n:
if k = 2 or isprime(k - 1) and isprime(k + 1) then k else NULL fi end:
seq(a(n), n = 1..1000); # Peter Luschny, Jul 14 2022
MATHEMATICA
k=2; lst={k}; Do[k=n^2-k; If[PrimeQ[k-1]&&PrimeQ[k+1], AppendTo[lst, k]], {n, 8!}]; lst
PROG
(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))};
a154734(5000000) \\ Hugo Pfoertner, Jul 14 2022
CROSSREFS
Sequence in context: A154882 A062000 A053040 * A291827 A287059 A059085
KEYWORD
nonn
AUTHOR
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.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 14:10 EDT 2024. Contains 371792 sequences. (Running on oeis4.)