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.

Showing 1-4 of 4 results.

A100208 Minimal permutation of the natural numbers such that the sum of squares of two consecutive terms is a prime.

Original entry on oeis.org

1, 2, 3, 8, 5, 4, 9, 10, 7, 12, 13, 20, 11, 6, 19, 14, 15, 22, 17, 18, 23, 30, 29, 16, 25, 24, 35, 26, 21, 34, 39, 40, 33, 28, 37, 32, 27, 50, 31, 44, 41, 46, 49, 36, 65, 38, 45, 52, 57, 68, 43, 42, 55, 58, 47, 48, 53, 62, 73, 60, 61, 54, 59, 64, 71, 66, 79, 56, 51, 76, 85, 72
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 08 2004

Keywords

Comments

a(1) = 1 and for n>1: a(n) = smallest m not occurring earlier such that m^2 + a(n-1)^2 is a prime; the primes are in A100209.
Note the same parity of a(n) and n for all terms. [Zak Seidov, Apr 27 2011]
Subsequence s(1..m) is a permutation of the natural numbers 1..m only for m=1,2,3. [Zak Seidov, Apr 28 2011]
All filtering primes (A100209) are distinct because primes of the form 4k+1 have a unique representation as the sum of two squares. [Zak Seidov, Apr 28 2011]

Crossrefs

Programs

  • Haskell
    import Data.Set (singleton, notMember, insert)
    a100208 n = a100208_list !! (n-1)
    a100208_list = 1 : (f 1 [1..] $ singleton 1) where
       f x (w:ws) s
         | w `notMember` s &&
           a010051 (x*x + w*w) == 1 = w : (f w [1..] $ insert w s)
         | otherwise                = f x ws s where
    -- Reinhard Zumkeller, Apr 28 2011
    
  • Mathematica
    nn = 100; unused = Range[2, nn]; t = {1}; While[k = 0; While[k++; k <= Length[unused] && ! PrimeQ[t[[-1]]^2 + unused[[k]]^2]]; k <= Length[unused], AppendTo[t, unused[[k]]]; unused = Delete[unused, k]]; t (* T. D. Noe, Apr 27 2011 *)
  • PARI
    v=[1];n=1;while(n<100,if(isprime(v[#v]^2+n^2)&&!vecsearch(vecsort(v),n),v=concat(v,n);n=0);n++);v \\ Derek Orr, Jun 01 2015
  • Python
    from sympy import isprime
    A100208 = [1]
    for n in range(1,100):
        a, b = 1, 1 + A100208[-1]**2
        while not isprime(b) or a in A100208:
            b += 2*a+1
            a += 1
        A100208.append(a) # Chai Wah Wu, Sep 01 2014
    

Formula

a(A100211(n)) = A100211(a(n)) = n.
a(n) = sqrt(A073658(n)).
a(n)^2 + a(n+1)^2 = A100209(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).

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

A100209 a(n) = A100208(n)^2 + A100208(n+1)^2.

Original entry on oeis.org

5, 13, 73, 89, 41, 97, 181, 149, 193, 313, 569, 521, 157, 397, 557, 421, 709, 773, 613, 853, 1429, 1741, 1097, 881, 1201, 1801, 1901, 1117, 1597, 2677, 3121, 2689, 1873, 2153, 2393, 1753, 3229, 3461, 2897, 3617, 3797, 4517, 3697, 5521, 5669, 3469, 4729
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 08 2004

Keywords

Comments

Pythagorean primes: A079260(a(n)) = 1, see A100210;
a(n) = A073658(n) + A073658(n+1).

Crossrefs

Cf. A002144.

A272878 a(0) = a(1) = 1, smallest a(n+1) > a(n-1) such that a(n)^2 + a(n+1)^2 is prime.

Original entry on oeis.org

1, 1, 2, 3, 8, 5, 16, 9, 26, 11, 30, 13, 32, 15, 34, 21, 44, 29, 46, 39, 50, 43, 60, 61, 64, 71, 66, 79, 74, 81, 100, 83, 102, 95, 104, 101, 114, 109, 134, 115, 136, 135, 146, 139, 154, 141, 160, 143, 168, 155, 172, 165, 178, 173, 190, 177, 200, 189, 206, 199
Offset: 0

Views

Author

Thomas Ordowski, May 08 2016

Keywords

Comments

The associated primes 2, 5, 13, 73, 89, 281, 337, 757, 797, ... create a strictly increasing sequence. What is the rate of its growth?
Positive integers that are not in this sequence are 4, 6, 7, 10, 12, 14, 17, 18, 19, 20, 22, 23, 24, 25, 27, ... - Altug Alkan, May 14 2016

Crossrefs

Programs

  • Mathematica
    a[0]=1; a[1]=1; a[n_]:=a[n]= Block[{t = a[n-2] + 1}, While[! PrimeQ[t^2 + a[n-1]^2], t++]; t]; Array[a, 80, 0] (* Giovanni Resta, May 08 2016 *)
  • PARI
    lista(nn) = {print1(x = 1, ", "); print1(y = 1, ", "); for (n=2, nn, z = x+1; while (! isprime(y^2+z^2), z++); print1(z, ", "); x = y; y = z;);} \\ Michel Marcus, May 08 2016

Extensions

More terms from Michel Marcus, May 08 2016
Showing 1-4 of 4 results.