login
A226145
Numbers n such that triangular(n) is a sum of three successive primes.
7
4, 5, 61, 82, 142, 166, 202, 233, 337, 394, 418, 422, 446, 493, 538, 661, 670, 841, 886, 1101, 1177, 1234, 1237, 1266, 1322, 1426, 1441, 1477, 1593, 1642, 1690, 1713, 1765, 1789, 1798, 1885, 1901, 1930, 1941, 2041, 2061, 2098, 2101, 2161, 2218, 2277, 2305, 2350, 2614
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
Cf. A167788 (the corresponding triangular numbers).
Sequence in context: A368018 A341575 A013331 * A042425 A109348 A192084
KEYWORD
nonn
AUTHOR
Alex Ratushnyak, May 28 2013
STATUS
approved