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.

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

This page as a plain text file.
%I A100208 #35 Jun 05 2020 06:31:59
%S A100208 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,
%T A100208 35,26,21,34,39,40,33,28,37,32,27,50,31,44,41,46,49,36,65,38,45,52,57,
%U A100208 68,43,42,55,58,47,48,53,62,73,60,61,54,59,64,71,66,79,56,51,76,85,72
%N A100208 Minimal permutation of the natural numbers such that the sum of squares of two consecutive terms is a prime.
%C A100208 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.
%C A100208 Note the same parity of a(n) and n for all terms. [_Zak Seidov_, Apr 27 2011]
%C A100208 Subsequence s(1..m) is a permutation of the natural numbers 1..m only for m=1,2,3. [_Zak Seidov_, Apr 28 2011]
%C A100208 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]
%H A100208 Zak Seidov, <a href="/A100208/b100208.txt">Table of n, a(n) for n = 1..20000</a>
%H A100208 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A100208 a(A100211(n)) = A100211(a(n)) = n.
%F A100208 a(n) = sqrt(A073658(n)).
%F A100208 a(n)^2 + a(n+1)^2 = A100209(n).
%t A100208 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 *)
%o A100208 (Haskell)
%o A100208 import Data.Set (singleton, notMember, insert)
%o A100208 a100208 n = a100208_list !! (n-1)
%o A100208 a100208_list = 1 : (f 1 [1..] $ singleton 1) where
%o A100208    f x (w:ws) s
%o A100208      | w `notMember` s &&
%o A100208        a010051 (x*x + w*w) == 1 = w : (f w [1..] $ insert w s)
%o A100208      | otherwise                = f x ws s where
%o A100208 -- _Reinhard Zumkeller_, Apr 28 2011
%o A100208 (Python)
%o A100208 from sympy import isprime
%o A100208 A100208 = [1]
%o A100208 for n in range(1,100):
%o A100208     a, b = 1, 1 + A100208[-1]**2
%o A100208     while not isprime(b) or a in A100208:
%o A100208         b += 2*a+1
%o A100208         a += 1
%o A100208     A100208.append(a) # _Chai Wah Wu_, Sep 01 2014
%o A100208 (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
%Y A100208 Cf. A100209, A100211, A171964, A181723, A181730 [_Zak Seidov_, Apr 27 2011].
%Y A100208 Cf. A080478, A010051.
%K A100208 nonn,easy
%O A100208 1,2
%A A100208 _Reinhard Zumkeller_, Nov 08 2004