OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..2300
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
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved