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 A244724 #9 Aug 05 2019 17:46:40 %S A244724 1,2,4,3,5,6,8,9,7,10,11,12,13,16,14,15,17,20,18,19,21,22,23,24,25,28, %T A244724 26,27,29,30,32,35,31,36,33,34,38,41,37,42,39,40,44,45,43,46,47,50,48, %U A244724 49,51,52,53,54,56,57,55,58,59,68,60,67,61,66,62,65,63 %N A244724 Lexicographically earliest permutation of the natural numbers such that primes and composites alternate in the sums of adjacent terms. %C A244724 For k > 0: a(2*k-1) + a(2*k) is prime, a(2*k) + a(2*k+1) is composite. %H A244724 Reinhard Zumkeller, <a href="/A244724/b244724.txt">Table of n, a(n) for n = 1..10000</a> %H A244724 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A244724 A010051(a(n)+a(n+1)) = n mod 2. %e A244724 . n | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 %e A244724 . a(n) | 1 2 4 3 5 6 8 9 7 10 11 12 13 16 14 15 17 20 18 19 %e A244724 . A026233(a(n)) | 1 1 2 2 3 3 4 5 4 6 5 7 6 10 8 9 7 12 11 8 . %o A244724 (Haskell) %o A244724 import Data.List (delete) %o A244724 a244724 n = a244724_list !! (n-1) %o A244724 a244724_list = 1 : f 1 [2..] where %o A244724 f x xs = f' xs where %o A244724 f' (u:us) | a010051' (x + u) == 1 = g u (delete u xs) %o A244724 | otherwise = f' us where %o A244724 g y ys = g' ys where %o A244724 g' (v:vs) | a010051' (y + v) == 0 = u : v : f v (delete v ys) %o A244724 | otherwise = g' vs %Y A244724 Cf. A244732 (inverse), A244731 (fixed points), A073846, A113321, A115316. %K A244724 nonn %O A244724 1,2 %A A244724 _Reinhard Zumkeller_, Jul 05 2014