Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 Oct 18 2021 11:16:56
%S 2,3,619,1123,3373,4603,6829,9067,18973,25933,29179,29741,33211,40583,
%T 48313,72923,74923,117991,130973,202201,231067,253993,255217,267317,
%U 291491,339139,346309,363829,423191,449621,476279,489337,519487,533713,539093,592507,602603,621133
%N Smallest of three consecutive primes whose sum is a triangular number.
%H Robert Israel, <a href="/A226148/b226148.txt">Table of n, a(n) for n = 1..2300</a>
%p R:= 2: count:= 1:
%p for k from 1 while count < 100 do
%p for j from 1 to 2 do
%p m:= 4*k+j;
%p x:= m*(m+1)/2;
%p q= prevprime(ceil(x/3));
%p p:= prevprime(q); r:= nextprime(q);
%p t:= p+q+r;
%p if t < x then while t < x do p:= q; q:= r; r:= nextprime(r); t:=p+q+r od
%p elif t > x then while t > x do r:= q; q:= p; p:= prevprime(p); t:= p+q+r od
%p fi;
%p if t = x then R:= R,p; count:= count+1; fi
%p od od :
%p R; # _Robert Israel_, Oct 18 2021
%o (C)
%o #include <stdio.h>
%o #include <stdlib.h>
%o #include <math.h>
%o #define TOP (1ULL<<30)
%o int main() {
%o unsigned long long i, j, p1, p2, r, s;
%o unsigned char *c = (unsigned char *)malloc(TOP/8);
%o memset(c, 0, TOP/8);
%o for (i=3; i < TOP; i+=2)
%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
%o for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);
%o for (p2=2, p1=3, i=5; i < TOP; i+=2)
%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
%o s = p2 + p1 + i;
%o r = sqrt(s*2);
%o if (r*(r+1)==s*2) printf("%llu, ", p2);
%o p2 = p1, p1 = i;
%o }
%o return 0;
%o }
%Y Cf. A076304, A206279, A226145, A226146, A226147, A226149, A226150.
%Y Cf. A167788 (the resulting triangular numbers).
%K nonn
%O 1,1
%A _Alex Ratushnyak_, May 28 2013