A181902 Numbers k such that the k-th triangular number is prime or the arithmetic mean of 2 successive primes.
2, 3, 5, 6, 9, 14, 15, 21, 24, 26, 30, 38, 39, 41, 48, 53, 54, 78, 80, 81, 87, 89, 92, 104, 116, 117, 119, 121, 122, 125, 126, 146, 149, 150, 153, 156, 158, 164, 165, 170, 171, 185, 186, 194, 206, 210, 218, 245, 248, 252, 255, 258, 270, 281, 285, 290, 296, 297
Offset: 1
Keywords
Examples
2 is a term because 2*(2+1)/2 = 3 is prime, 3 is a term because 3*(3+1)/2 = (5+7)/2, 5 is a term because 5*(5+1)/2 = (13+17)/2.
Links
- Charles R Greathouse IV, Table of n, a(n) for n = 1..10000
Programs
-
Magma
[2] cat [n: n in [3..320] | 2*t eq PreviousPrime(t)+NextPrime(t) where t is n*(n+1) div 2]; // Bruno Berselli, Apr 04 2012
-
Mathematica
a = {2}; For[n = 1, n < 320, n++, t = n*(n + 1)/2; If[t == (NextPrime[t] + NextPrime[t, -1])/2, AppendTo[a, n], 1]]; Print[a]; (* David Scambler, Apr 02 2012 *)
-
PARI
is(n)=n*=(n+1)/2;n>1&&2*n==nextprime(n)+precprime(n) \\ Charles R Greathouse IV, Apr 04 2012