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

A171964 "Late bird" numbers in A100208.

Original entry on oeis.org

4, 7, 11, 6, 14, 15, 17, 18, 16, 24, 26, 21, 28, 32, 27, 31, 36, 38, 45, 43, 42, 47, 48, 53, 54, 59, 56, 51, 63, 67, 70, 69, 78, 87, 81, 74, 89, 91, 90, 84, 94, 75, 93, 98, 107, 110, 111, 104, 105, 116, 115, 108, 120, 99, 123, 128, 125, 114, 126, 121, 137, 138, 132, 143, 141, 139, 134, 131, 144, 149, 155, 142, 153, 147, 159, 164, 161, 170, 171, 169, 167, 152, 165, 178, 173, 168, 162, 188, 187, 183, 185, 186, 181, 201, 206, 192, 205, 207, 213, 198, 217, 194, 219, 221, 210, 227, 214, 224, 225, 226, 234, 229, 239, 231, 237, 243, 245, 216, 228, 252, 247, 241, 249, 259, 246, 256, 261, 260, 263, 242, 267, 270, 262, 253, 281, 276, 269, 264, 271, 284, 285, 286, 294, 290
Offset: 1

Views

Author

Zak Seidov, Nov 19 2010

Keywords

Comments

Numbers n with property that n = A100208(m) with m > n;
n's are given in the order of their appearances in A100208 (and hence the sequence is not monotone).

Crossrefs

Showing 1-2 of 2 results.