OFFSET
1,1
LINKS
David A. Corneth, Table of n, a(n) for n = 1..10433 (first 800 terms from Harvey P. Dale, terms <= 10^6)
EXAMPLE
For k = 5, triangular(k) = triangular(5) = 15. 15/3 = 5. The next prime larger or equal to 5 is 5. The prime before 5 is 3. If there is a triple of consecutive primes that sum to 15 then 3 and 5 are two of them. Then the third one must be 15 - 3 - 5 = 7. 7 is prime and 3, 5 and 7 are consecutive primes (as 7 is the next larger prime than 5 or the previous prime to 3). Therefore, k = 5 is in the sequence. - David A. Corneth, Sep 18 2019
MATHEMATICA
(Sqrt[8#+1]-1)/2&/@Select[Total/@Partition[Prime[Range[ 100000]], 3, 1], OddQ[ Sqrt[8#+1]]&] (* Harvey P. Dale, Sep 18 2019 *)
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, ", r);
p2 = p1, p1 = i;
}
return 0;
}
(PARI) upto(n) = {my(res = List(), t = 10); for(i = 5, n, c = t/3; p = nextprime(ceil(c)); q = precprime(p - 1); r = t - p - q; if(isprime(r) && nextprime(r + 1) == q || nextprime(p + 1) == r, listput(res, i - 1)); t+=i); res}
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved