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.

A111163 Triangular numbers that are sums of two consecutive primes.

This page as a plain text file.
%I A111163 #51 Oct 29 2024 09:11:03
%S A111163 36,78,120,210,276,300,630,946,990,1770,1830,2556,2850,3240,3570,4278,
%T A111163 4950,5460,8256,9870,10878,11026,12090,12720,20100,20910,23436,26796,
%U A111163 31626,34980,41616,43660,46056,55278,56616,57630,59340,66066,73920
%N A111163 Triangular numbers that are sums of two consecutive primes.
%C A111163 Intersection of A000217 and A001043. - _Michel Marcus_, May 18 2015
%H A111163 Chai Wah Wu, <a href="/A111163/b111163.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..472 from K. D. Bajpai, n = 473..1000 from T. D. Noe)
%e A111163 36 = 8(8+1)/2 = 17 + 19. Therefore 36 belongs to the sequence.
%p A111163 P:=proc()local i,a,b,c;c:=1;for i from 1 to 1200000 do;
%p A111163 a:=ithprime(i)+ithprime(i+1);b:=(-1+(sqrt(8*a+1)))/2;
%p A111163 if  b=floor(b) then lprint(c,a);c:=c+1;fi; od;end:P();
%p A111163 # _K. D. Bajpai_, Jun 30 2013
%t A111163 Select[Table[Prime[n] + Prime[n + 1], {n, 4500}], IntegerQ[Sqrt[1 + 8# ]] &] (* _Ray Chandler_, Oct 22 2005 *)
%t A111163 t = {}; n = 0; While[Length[t] < 100, n++; s = Prime[n] + Prime[n + 1]; If[TriangularQ[s], AppendTo[t, s]]]; t (* _T. D. Noe_, Jun 30 2013 *)
%o A111163 (PARI) {p=2; ct=0; while(ct<66, q=nextprime(p+1); s=p+q; if( issquare(8*s+1), print1(s, ", "); ct++); p=q)} \\ _Klaus Brockhaus_, Oct 22 2005
%o A111163 (Python)
%o A111163 from sympy import nextprime as np
%o A111163 from sympy import prevprime as pp
%o A111163 n=1
%o A111163 t=n*(n+1)//2
%o A111163 while t>0:
%o A111163     if t%2==0 and t>3:
%o A111163         i=t//2
%o A111163         p=pp(i); q=np(p)
%o A111163         if p+q==t :
%o A111163             print(t)
%o A111163     n=n+1
%o A111163     t=n*(n+1)//2 # _Abhiram R Devesh_, May 17 2015
%o A111163 (Python)
%o A111163 from sympy import prevprime,nextprime,isprime
%o A111163 A111163_list = [n*(n+1)//2 for n in range(3,10**4) if not isprime(n*(n+1)//4) and prevprime(n*(n+1)//4)+nextprime(n*(n+1)//4) == n*(n+1)//2] # _Chai Wah Wu_, Feb 11 2018
%Y A111163 Cf. A000217 (triangular numbers), A001043 (sums of consecutive primes).
%K A111163 nonn
%O A111163 1,1
%A A111163 _Joseph L. Pe_, Oct 20 2005
%E A111163 Extended by _Ray Chandler_ and _Klaus Brockhaus_, Oct 22 2005