login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A226148
Smallest of three consecutive primes whose sum is a triangular number.
3
2, 3, 619, 1123, 3373, 4603, 6829, 9067, 18973, 25933, 29179, 29741, 33211, 40583, 48313, 72923, 74923, 117991, 130973, 202201, 231067, 253993, 255217, 267317, 291491, 339139, 346309, 363829, 423191, 449621, 476279, 489337, 519487, 533713, 539093, 592507, 602603, 621133
OFFSET
1,1
LINKS
MAPLE
R:= 2: count:= 1:
for k from 1 while count < 100 do
for j from 1 to 2 do
m:= 4*k+j;
x:= m*(m+1)/2;
q= prevprime(ceil(x/3));
p:= prevprime(q); r:= nextprime(q);
t:= p+q+r;
if t < x then while t < x do p:= q; q:= r; r:= nextprime(r); t:=p+q+r od
elif t > x then while t > x do r:= q; q:= p; p:= prevprime(p); t:= p+q+r od
fi;
if t = x then R:= R, p; count:= count+1; fi
od od :
R; # Robert Israel, Oct 18 2021
PROG
(C)
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define TOP (1ULL<<30)
int main() {
unsigned long long i, j, p1, p2, r, s;
unsigned char *c = (unsigned char *)malloc(TOP/8);
memset(c, 0, TOP/8);
for (i=3; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
for (p2=2, p1=3, i=5; i < TOP; i+=2)
if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
s = p2 + p1 + i;
r = sqrt(s*2);
if (r*(r+1)==s*2) printf("%llu, ", p2);
p2 = p1, p1 = i;
}
return 0;
}
CROSSREFS
Cf. A167788 (the resulting triangular numbers).
Sequence in context: A240709 A264577 A165770 * A108332 A256115 A066685
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved