login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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). 5

%I

%S 1,2,3,8,13,20,23,30,31,44,49,74,79,80,89,96,101,104,105,116,119,124,

%T 131,134,139,140,149,150,157,158,165,172,173,178,183,202,203,230,231,

%U 250,257,260,261,274,289,290,291,296,311,334,335,342,343,360,367,372

%N 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 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 A[1]:= 1:

%p for n from 2 to 100 do

%p for k from A[n-1]+1 while not isprime(k^2+A[n-1]^2) do od:

%p A[n]:= k

%p od:

%p seq(A[n],n=1..100); # _Robert Israel_, Sep 01 2014

%t 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 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 (PARI) p=1;print1(p",");for(n=2,1000, if(isprime(p+n^2),print1(n",");p=n^2))

%o (Haskell)

%o a080478 n = a080478_list !! (n-1)

%o a080478_list = 1 : f 1 [2..] where

%o f x (y:ys) | a010051 (x*x + y*y) == 1 = y : (f y ys)

%o | otherwise = f x ys

%o -- _Reinhard Zumkeller_, Apr 28 2011

%o (Python)

%o from sympy import isprime

%o A080478, a = [1], 1

%o for _ in range(1,10000):

%o ....a += 1

%o ....b = 2*a*(a-1) + 1

%o ....while not isprime(b):

%o ........b += 4*(a+1)

%o ........a += 2

%o ....A080478.append(a) # _Chai Wah Wu_, Sep 01 2014

%Y Cf. A073658, A100208, A010051.

%K nonn

%O 1,2

%A _Ralf Stephan_, Mar 22 2003

%E PARI program corrected by Zak Seidov, Apr 14 2008

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 24 09:37 EDT 2019. Contains 324323 sequences. (Running on oeis4.)