cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A226153 Numbers n such that triangular(n) is an average of 4 consecutive primes.

This page as a plain text file.
%I A226153 #16 Sep 17 2024 15:40:40
%S A226153 5,10,14,15,22,34,49,54,64,66,81,93,104,116,121,122,146,154,156,180,
%T A226153 194,221,222,236,270,299,320,332,334,337,346,360,369,371,374,387,416,
%U A226153 417,429,435,444,472,492,498,511,520,551,556,617,622,637,654,657,670,674,677,680
%N A226153 Numbers n such that triangular(n) is an average of 4 consecutive primes.
%H A226153 Zak Seidov, <a href="/A226153/b226153.txt">Table of n, a(n) for n = 1..3000</a>
%p A226153 A034963 := proc(n)
%p A226153     add(ithprime(i), i=n..n+3) ;
%p A226153 end proc:
%p A226153 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 A226153 for n from 1 to 90000 do
%p A226153     s := A034963(n)/4 ;
%p A226153     if type(s,'integer') then
%p A226153     tr := istriangular(s) ;
%p A226153     if tr >= 0  then
%p A226153         printf("%d, ", tr) ;
%p A226153     end if;
%p A226153     end if;
%p A226153 end do: # _R. J. Mathar_, Jun 06 2013
%t A226153 Module[{nn=30000,ntrs,m},ntrs=Table[{n,(n(n+1))/2},{n,nn}];m=Mean/@Partition[Prime[ Range[ nn]],4,1];Select[ntrs,MemberQ[m,#[[2]]]&]][[;;,1]] (* _Harvey P. Dale_, Jun 08 2023 *)
%t A226153 (Sqrt[8#+1]-1)/2&/@Select[Mean/@Partition[Prime[Range[25000]],4,1],OddQ[Sqrt[8#+1]]&] (* _Harvey P. Dale_, Sep 17 2024 *)
%o A226153 (C)
%o A226153 #include <stdio.h>
%o A226153 #include <stdlib.h>
%o A226153 #include <math.h>
%o A226153 #define TOP (1ULL<<30)
%o A226153 int main() {
%o A226153   unsigned long long i, j, p1, p2, p3, r, s;
%o A226153   unsigned char *c = (unsigned char *)malloc(TOP/8);
%o A226153   memset(c, 0, TOP/8);
%o A226153   for (i=3; i < TOP; i+=2)
%o A226153     if ((c[i>>4] & (1<<((i>>1) & 7)))==0 /*&& i<(1ULL<<32)*/)
%o A226153         for (j=i*i>>1; j<TOP; j+=i)  c[j>>3] |= 1 << (j&7);
%o A226153   for (p3=2, p2=3, p1=5, i=7; i < TOP; i+=2)
%o A226153     if ((c[i>>4] & (1<<((i>>1) & 7)))==0) {
%o A226153       s = p3 + p2 + p1 + i;
%o A226153       if (s%4==0) {
%o A226153         s/=4;
%o A226153         r = sqrt(s*2);
%o A226153         if (r*(r+1)==s*2) printf("%llu, ", r);
%o A226153       }
%o A226153       p3 = p2, p2 = p1, p1 = i;
%o A226153     }
%o A226153   return 0;
%o A226153 }
%Y A226153 Cf. A102655, A226151.
%K A226153 nonn
%O A226153 1,1
%A A226153 _Alex Ratushnyak_, May 28 2013