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.
%I A256210 #21 Aug 04 2018 10:47:12 %S A256210 2,1,3,5,4,6,7,9,11,13,8,10,15,12,14,17,16,19,18,21,23,20,22,25,27,29, %T A256210 31,24,26,28,33,30,35,32,37,34,39,36,41,38,40,43,45,47,42,44,49,46,48, %U A256210 51,50,53,52,55,57,59,54,56,58,61,63,60,65,62,67,64,69 %N A256210 Lexicographically earliest permutation of positive integers starting with 2 such that a(a(n)+a(n+1)) is odd for all n. %C A256210 This is the sequence U defined in the comments on A255003. %H A256210 Alois P. Heinz, <a href="/A256210/b256210.txt">Table of n, a(n) for n = 1..20000</a> %H A256210 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %p A256210 N:= 100: # to get a(n) for n <= N %p A256210 maxodd:= -1: %p A256210 maxeven:= 2: %p A256210 a[1]:= 2: %p A256210 needodd:= {}: %p A256210 for n from 2 to N do %p A256210 if member(n,needodd) or maxodd < maxeven then %p A256210 a[n]:= maxodd + 2; %p A256210 maxodd:= a[n]; %p A256210 else %p A256210 a[n]:= maxeven + 2; %p A256210 maxeven:= a[n]; %p A256210 fi; %p A256210 needodd:= needodd union {a[n-1]+a[n]}; %p A256210 od: %p A256210 seq(a[n],n=1..N); # _Robert Israel_, Mar 26 2015 %t A256210 nn = 100; %t A256210 maxodd = -1; %t A256210 maxeven = 2; %t A256210 a[1] = 2; %t A256210 needodd = {}; %t A256210 For[n = 2, n <= nn, n++, %t A256210 If[MemberQ[needodd, n] || maxodd < maxeven, %t A256210 a[n] = maxodd + 2; %t A256210 maxodd = a[n] %t A256210 , %t A256210 a[n] = maxeven + 2; %t A256210 maxeven = a[n] %t A256210 ]; %t A256210 needodd = needodd ~Union~ {a[n-1]+a[n]}; %t A256210 ]; %t A256210 Array[a, nn] (* _Jean-François Alcover_, Aug 04 2018, after _Robert Israel_ *) %o A256210 (Haskell) after Robert Israel's Maple program %o A256210 import Data.IntSet (empty, member, insert) %o A256210 a256210 n = a256210_list !! (n-1) %o A256210 a256210_list = 2 : f [2 ..] 2 [1, 3 ..] [4, 6 ..] empty where %o A256210 f (x:xs) y us'@(u:us) vs'@(v:vs) s %o A256210 | member x s || u < v = u : f xs u us vs' (insert (y + u) s) %o A256210 | otherwise = v : f xs v us' vs (insert (y + v) s) %o A256210 -- _Reinhard Zumkeller_, Mar 26 2015 %Y A256210 Cf. A255003. %Y A256210 Cf. A256371 (inverse), A256372 (fixed points). %K A256210 nonn %O A256210 1,1 %A A256210 _N. J. A. Sloane_, Mar 26 2015