login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A226151 Numbers n such that triangular(n) is a sum of 4 consecutive primes. 4

%I #8 Apr 06 2016 12:31:44

%S 8,15,39,56,60,144,155,203,212,216,263,388,451,464,480,555,619,644,

%T 680,723,736,788,791,799,876,903,1012,1056,1143,1239,1284,1368,1479,

%U 1547,1611,1684,1695,1703,1827,1859,1908,1939,2100,2108,2135,2148,2152,2187,2199,2216

%N Numbers n such that triangular(n) is a sum of 4 consecutive primes.

%H Harvey P. Dale, <a href="/A226151/b226151.txt">Table of n, a(n) for n = 1..500</a>

%p istriangular:=proc(n) local t1; t1:=floor(sqrt(2*n)); if n = t1*(t1+1)/2 then return t1 ; else return -1; end if; end;

%p A034963 := proc(n)

%p add(ithprime(i),i=n..n+3) ;

%p end proc:

%p for n from 1 to 90000 do

%p ist := istriangular(A034963(n)) ;

%p if ist >= 0 then

%p printf("%d,",ist) ;

%p end if;

%p end do: # _R. J. Mathar_, Jun 04 2013

%t (Sqrt[8#+1]-1)/2&/@Select[Total/@Partition[Prime[Range[ 60000]],4,1], OddQ[ Sqrt[8#+1]]&] (* _Harvey P. Dale_, Apr 06 2016 *)

%o (C)

%o #include <stdio.h>

%o #include <stdlib.h>

%o #include <math.h>

%o #define TOP (1ULL<<30)

%o int main() {

%o unsigned long long i, j, p1, p2, p3, r, s;

%o unsigned char *c = (unsigned char *)malloc(TOP/8);

%o memset(c, 0, TOP/8);

%o for (i=3; i < TOP; i+=2)

%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)

%o for (j=i*i>>1; j<TOP; j+=i) c[j>>3] |= 1 << (j&7);

%o for (p3=2, p2=3, p1=5, i=7; i < TOP; i+=2)

%o if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {

%o s = p3 + p2 + p1 + i;

%o r = sqrt(s*2);

%o if (r*(r+1)==s*2) printf("%llu, ", r);

%o p3 = p2, p2 = p1, p1 = i;

%o }

%o return 0;

%o }

%Y Cf. A000217, A034963, A051395, A206280, A226154.

%K nonn

%O 1,1

%A _Alex Ratushnyak_, May 28 2013

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 19 15:03 EDT 2024. Contains 371794 sequences. (Running on oeis4.)