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.

A257117 Smaller of two consecutive primes each of which is the sum of two squares.

This page as a plain text file.
%I A257117 #33 Oct 11 2024 16:11:01
%S A257117 37,109,193,229,277,313,349,389,397,401,449,457,509,613,661,673,701,
%T A257117 757,761,769,797,853,929,937,997,1009,1093,1109,1193,1201,1213,1237,
%U A257117 1373,1429,1489,1549,1597,1609,1637,1669
%N A257117 Smaller of two consecutive primes each of which is the sum of two squares.
%C A257117 This sequence is a subsequence of A002313 (Primes of form x^2 + y^2).
%H A257117 Abhiram R Devesh, <a href="/A257117/b257117.txt">Table of n, a(n) for n = 1..1000</a>
%e A257117 37 = 1^2 + 6^2 and 41 = 4^2 + 5^2, so 37 is a term.
%e A257117 109 = 3^2 + 10^2 and 113 = 7^2 + 8^2, so 109 is a term.
%o A257117 (Python)
%o A257117 import sympy
%o A257117 def sumpow(sn0, n, p):
%o A257117     af=0; bf=0; an=1
%o A257117     sn1=sn0+n
%o A257117     if n!=0:
%o A257117         sn1=sympy.nextprime(sn0, n)
%o A257117     while an**p<sn1:
%o A257117         bnsq=sn1-(an**p)
%o A257117         bn=sympy.ntheory.perfect_power(bnsq)
%o A257117         if bn!=False and list(bn)[1]==p:
%o A257117             af=an
%o A257117             bf=list(bn)[0]
%o A257117             an=sn1+100
%o A257117         an=an+1
%o A257117     return(af, bf)
%o A257117 s0=1; pw=2
%o A257117 while s0>0:
%o A257117     a0, b0=sumpow(s0, 0, pw)
%o A257117     a1, b1=sumpow(s0, 1, pw)
%o A257117     if a0!=0 and a1!=0:
%o A257117         print(s0)
%o A257117     s0=sympy.nextprime(s0)
%Y A257117 Cf. A002313 (Primes of form x^2 + y^2).
%K A257117 nonn,easy
%O A257117 1,1
%A A257117 _Abhiram R Devesh_, Apr 25 2015