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 A249990 #25 Nov 19 2023 13:02:35 %S A249990 2,1,6,3,4,12,5,8,7,16,9,10,13,14,22,15,18,11,24,17,32,25,26,19,20,23, %T A249990 30,48,31,38,21,28,27,34,33,52,35,42,29,36,39,40,49,50,58,51,54,41,44, %U A249990 37,60,43,66,53,84,67,68,61,62,45,46,55,56,59,76,94,77,90 %N A249990 Start with the natural numbers, reverse the order in each pair, skip one pair, reverse the order in each triple, skip one triple, and so on. %C A249990 A permutation of natural numbers generated by the following algorithm. %C A249990 Start with the natural numbers. Reverse the order of numbers in each pair. Skip one pair. In the remainder (that is, "4, 3, 6, 5, 8, 7, 10, 9, 12, 11,...") reverse the order in each triple. Skip one triple. In the remainder (it starts with "7, 8, 5, 12, 9, 10") reverse the order in each tetrad. Skip one tetrad. And so on. %H A249990 Reinhard Zumkeller, <a href="/A249990/b249990.txt">Table of n, a(n) for n = 1..10000</a> %H A249990 Popular Computing (Calabasas, CA), <a href="/A249990/a249990.png">Problems 195 and 196</a>, Vol. 5 (No. 55, 1977), annotated and scanned copy of page PC55-4. See Problem 195. %H A249990 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A249990 Start with: %e A249990 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ... %e A249990 After the first step: %e A249990 2, 1, 4, 3, 6, 5, 8, 7, 10, 9, 12, 11, 14, 13, 16, 15, 18, ... %e A249990 After the 2nd step: %e A249990 2, 1, 6, 3, 4, 7, 8, 5, 12, 9, 10, 13, 14, 11, 18, 15, 16, ... %e A249990 After the 3rd step: %e A249990 2, 1, 6, 3, 4, 12, 5, 8, 7, 14, 13, 10, 9, 16, 15, 18, 11, ... %o A249990 (Python) %o A249990 TOP = 100 %o A249990 a = list(range(TOP)) %o A249990 for step in range(2,TOP): %o A249990 numBlocks = (len(a)-1) // step %o A249990 if numBlocks==0: break %o A249990 a = a[:(1+numBlocks*step)] %o A249990 for pos in range(1,len(a),step): %o A249990 a[pos:pos+step] = a[pos+step-1:pos-1:-1] %o A249990 for i in range(1, step+1): print(str(a[i]), end=',') %o A249990 a[1:] = a[step+1:] %o A249990 (Haskell) %o A249990 a249990 n = a249990_list !! (n-1) %o A249990 a249990_list = f 2 [1..] where %o A249990 f k xs = reverse ys ++ f (k + 1) (g zs) where %o A249990 g us = reverse vs ++ g ws where %o A249990 (vs, ws) = splitAt k us %o A249990 (ys, zs) = splitAt k xs %o A249990 -- _Reinhard Zumkeller_, Dec 17 2014 %Y A249990 Cf. A000960, A026239, A249991. %Y A249990 Cf. A252448 (inverse), A252458 (fixed points). %K A249990 nonn %O A249990 1,1 %A A249990 _Alex Ratushnyak_, Nov 27 2014