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.

A257118 Smallest of three consecutive prime numbers each of which is the sum of two squares.

This page as a plain text file.
%I A257118 #37 Jan 15 2025 17:48:44
%S A257118 89,389,397,449,661,757,761,929,997,1193,1201,1669,2213,2269,2293,
%T A257118 2593,2609,2617,2741,3037,3041,3209,3217,3413,3433,3449,3697,3877,
%U A257118 4397,4801,5189,5233,5237,5569,5689,5717,6101,6217,6389,6469,6733,6829,6833,6997,7529
%N A257118 Smallest of three consecutive prime numbers each of which is the sum of two squares.
%C A257118 This sequence is a subsequence of A257117.
%H A257118 Harvey P. Dale, <a href="/A257118/b257118.txt">Table of n, a(n) for n = 1..200</a>
%e A257118 389 = 10^2 + 17^2, 397 = 6^2 + 19^2, and 401 = 1^2 + 20^2, so 389 is a term.
%e A257118 397 = 6^2 + 19^2, 401 = 1^2 + 20^2, and 409 = 3^2 + 20^2, so 397 is a term.
%t A257118 Prime/@SequencePosition[Table[If[Count[IntegerPartitions[n,{2}],_?(AllTrue[ Sqrt[#],IntegerQ]&)]>0,1,0],{n,Prime[Range[3000]]}],{1,1,1},Overlaps-> All] [[All,1]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Jul 08 2018 *)
%o A257118 (Python)
%o A257118 # a(1) is not displayed.
%o A257118 import sympy
%o A257118 def sumpow(sn0, n, p):
%o A257118     af=0; bf=0; an=1
%o A257118     sn1=sn0+n
%o A257118     if n!=0:
%o A257118         sn1=sympy.nextprime(sn0, n)
%o A257118     while an**p<sn1:
%o A257118         bnsq=sn1-(an**p)
%o A257118         bn=sympy.ntheory.perfect_power(bnsq)
%o A257118         if bn!=False and list(bn)[1]==p:
%o A257118             af=an
%o A257118             bf=list(bn)[0]
%o A257118             an=sn1+100
%o A257118         an=an+1
%o A257118     return(af, bf)
%o A257118 s0=1; pw=2
%o A257118 while s0>0:
%o A257118     a0, b0=sumpow(s0, 0, pw)
%o A257118     a1, b1=sumpow(s0, 1, pw)
%o A257118     a2, b2=sumpow(s0, 2, pw)
%o A257118     if a0!=0 and a1!=0 and a2!=0:
%o A257118         print(s0)
%o A257118     s0=sympy.nextprime(s0)
%Y A257118 Cf. A064716 (Smallest member of three consecutive numbers).
%Y A257118 Cf. A257117 (Smallest member of two consecutive prime numbers).
%K A257118 nonn,easy
%O A257118 1,1
%A A257118 _Abhiram R Devesh_, Apr 25 2015
%E A257118 Corrected and extended by and prior b-file replaced by _Harvey P. Dale_, Jul 08 2018