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.

A062703 Squares that are the sum of two consecutive primes.

This page as a plain text file.
%I A062703 #35 May 25 2022 02:00:35
%S A062703 36,100,144,576,1764,2304,3844,5184,7056,8100,12100,14400,14884,30276,
%T A062703 41616,43264,48400,53824,57600,69696,93636,106276,112896,138384,
%U A062703 148996,166464,168100,197136,206116,207936,219024,220900,224676,272484,298116,302500,352836
%N A062703 Squares that are the sum of two consecutive primes.
%H A062703 Michael S. Branicky, <a href="/A062703/b062703.txt">Table of n, a(n) for n = 1..22054</a> (terms 1..100 from Harry J. Smith)
%F A062703 a(n) = A074924(n)^2.
%F A062703 a(n) = A000040(i) + A000040(i+1) with i = A064397(n) = A000720(A061275(n)). - _M. F. Hasler_, Jan 03 2020
%e A062703 prime(7) + prime(8) = 17 + 19 = 36 = 6^2.
%t A062703 PrevPrim[n_] := Block[{k = n - 1}, While[ !PrimeQ[k], k-- ]; k]; NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{m = Floor[n/2]}, s = PrevPrim[m] + NextPrim[m]; If[s == n, True, False]]; Select[ Range[550], f[ #^2] &]^2
%t A062703 t := Table[Prime[n] + Prime[n + 1], {n, 15000}]; Select[t, IntegerQ[Sqrt[#]] &] (* _Carlos Eduardo Olivieri_, Feb 25 2015 *)
%o A062703 (PARI) {for(n=1,100,(p=precprime(n^2/2))+nextprime(p+2) == n^2 && print1(n^2", "))} \\ _Zak Seidov_, Feb 17 2011
%o A062703 (PARI) A062703(n)=A074924(n)^2 \\ _M. F. Hasler_, Jan 03 2020
%o A062703 (Python)
%o A062703 from itertools import count, islice
%o A062703 from sympy import nextprime, prevprime
%o A062703 def agen(): # generator of terms
%o A062703     for k in count(4, step=2):
%o A062703         kk = k*k
%o A062703         if prevprime(kk//2+1) + nextprime(kk//2-1) == kk:
%o A062703             yield kk
%o A062703 print(list(islice(agen(), 37))) # _Michael S. Branicky_, May 24 2022
%Y A062703 Squares in A001043. See A226524 for cubes.
%Y A062703 Cf. A074924 (square roots), A061275 (lesser of the primes), A064397 (index of that prime).
%Y A062703 Cf. A080665 (same with sum of three consecutive primes).
%K A062703 easy,nonn
%O A062703 1,1
%A A062703 _Jason Earls_, Jul 11 2001
%E A062703 Edited by _Robert G. Wilson v_, Mar 02 2003
%E A062703 Edited (crossrefs completed, obsolete PARI code deleted) by _M. F. Hasler_, Jan 03 2020