login
A226147
Numbers n such that triangular(n) is an average of three successive primes.
2
193, 233, 265, 301, 526, 709, 753, 922, 961, 962, 986, 1126, 1178, 1285, 1373, 1485, 1525, 1537, 1558, 1601, 1710, 1737, 1962, 1965, 2202, 2437, 2466, 2578, 2685, 2693, 2862, 3206, 3346, 3462, 3622, 3682, 3937, 3938, 3965, 4005, 4017, 4018, 4058, 4393, 4489, 4498, 4717
OFFSET
1,1
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;
if ((s%3)==0) {
s/=3;
r = sqrt(s*2);
if (r*(r+1)==s*2) printf("%llu, ", r);
}
p2 = p1, p1 = i;
}
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved