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).

Original entry on oeis.org

1, 2, 3, 8, 13, 20, 23, 30, 31, 44, 49, 74, 79, 80, 89, 96, 101, 104, 105, 116, 119, 124, 131, 134, 139, 140, 149, 150, 157, 158, 165, 172, 173, 178, 183, 202, 203, 230, 231, 250, 257, 260, 261, 274, 289, 290, 291, 296, 311, 334, 335, 342, 343, 360, 367, 372
Offset: 1

Views

Author

Ralf Stephan, Mar 22 2003

Keywords

Crossrefs

Programs

  • Haskell
    a080478 n = a080478_list !! (n-1)
    a080478_list = 1 : f 1 [2..] where
       f x (y:ys) | a010051 (x*x + y*y) == 1 = y : (f y ys)
                  | otherwise                = f x ys
    -- Reinhard Zumkeller, Apr 28 2011
    
  • Maple
    A[1]:= 1:
    for n from 2 to 100 do
      for k from A[n-1]+1 while not isprime(k^2+A[n-1]^2) do od:
      A[n]:= k
    od:
    seq(A[n],n=1..100); # Robert Israel, Sep 01 2014
  • Mathematica
    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 *)
    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 *)
  • PARI
    p=1;print1(p",");for(n=2,1000, if(isprime(p+n^2),print1(n",");p=n^2))
    
  • Python
    from sympy import isprime
    A080478, a = [1], 1
    for _ in range(1,10000):
        a += 1
        b = 2*a*(a-1) + 1
        while not isprime(b):
            b += 4*(a+1)
            a += 2
        A080478.append(a) # Chai Wah Wu, Sep 01 2014

Extensions

PARI program corrected by Zak Seidov, Apr 14 2008