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.

A080478 a(n) = smallest k>a(n-1) such that k^2+a(n-1)^2 is prime, starting with a(1)=1. Square roots of A062067(n).

This page as a plain text file.
%I A080478 #33 May 22 2025 10:21:35
%S A080478 1,2,3,8,13,20,23,30,31,44,49,74,79,80,89,96,101,104,105,116,119,124,
%T A080478 131,134,139,140,149,150,157,158,165,172,173,178,183,202,203,230,231,
%U A080478 250,257,260,261,274,289,290,291,296,311,334,335,342,343,360,367,372
%N A080478 a(n) = smallest k>a(n-1) such that k^2+a(n-1)^2 is prime, starting with a(1)=1. Square roots of A062067(n).
%H A080478 Chai Wah Wu, <a href="/A080478/b080478.txt">Table of n, a(n) for n = 1..10000</a> (first 2000 terms from Zak Seidov).
%p A080478 A[1]:= 1:
%p A080478 for n from 2 to 100 do
%p A080478   for k from A[n-1]+1 while not isprime(k^2+A[n-1]^2) do od:
%p A080478   A[n]:= k
%p A080478 od:
%p A080478 seq(A[n],n=1..100); # _Robert Israel_, Sep 01 2014
%t A080478 nxt[n_]:=Module[{n2=n^2,k=n+1},While[!PrimeQ[k^2+n2],k++];k]; NestList[nxt,1,60] (* _Harvey P. Dale_, Jun 24 2012 *)
%t A080478 a=1;sq={1}; Do[a2=a^2;b=a+1;While[!PrimeQ[a2+b^2],b=b+2]; AppendTo[sq,b]; a=b,{100}];sq (* _Zak Seidov_, Feb 21 2014 *)
%o A080478 (PARI) p=1;print1(p",");for(n=2,1000, if(isprime(p+n^2),print1(n",");p=n^2))
%o A080478 (Haskell)
%o A080478 a080478 n = a080478_list !! (n-1)
%o A080478 a080478_list = 1 : f 1 [2..] where
%o A080478    f x (y:ys) | a010051 (x*x + y*y) == 1 = y : (f y ys)
%o A080478               | otherwise                = f x ys
%o A080478 -- _Reinhard Zumkeller_, Apr 28 2011
%o A080478 (Python)
%o A080478 from sympy import isprime
%o A080478 A080478, a = [1], 1
%o A080478 for _ in range(1,10000):
%o A080478     a += 1
%o A080478     b = 2*a*(a-1) + 1
%o A080478     while not isprime(b):
%o A080478         b += 4*(a+1)
%o A080478         a += 2
%o A080478     A080478.append(a) # _Chai Wah Wu_, Sep 01 2014
%Y A080478 Cf. A073658, A100208, A010051.
%K A080478 nonn
%O A080478 1,2
%A A080478 _Ralf Stephan_, Mar 22 2003
%E A080478 PARI program corrected by Zak Seidov, Apr 14 2008