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”).

A226150
Smallest of three consecutive primes whose average is a triangular number.
5
18713, 27253, 35227, 45433, 138587, 251677, 283861, 425489, 462221, 463189, 486583, 634493, 694409, 826211, 943231, 1103341, 1163557, 1181927, 1214453, 1282387, 1462891, 1509439, 1925681, 1931569, 2425487, 2970689, 3041803, 3324323, 3605939, 3627451, 4096933, 5140781
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, ", p2);
}
p2 = p1, p1 = i;
}
return 0;
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved