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 A035491 #17 Aug 15 2022 10:27:48 %S A035491 2,1,3,2,4,1,1,3,5,2,6,4,6,1,4,3,7,5,8,2,5,6,8,1,2,4,9,3,10,7,9,5,3,6, %T A035491 10,8,7,1,11,2,12,4,1,9,11,5,2,3,12,6,4,10,13,8,14,7,4,1,10,9,13,11,8, %U A035491 5,14,2,7,3,15,12,16,6,2,4,7,1,3,10,15,9,12,13,16,11,6,8,17,5,18,14 %N A035491 Relevant part of deck in Guy's shuffling problem (A035485): row n of the table lists the first 2n "cards" (numbers) after the n-th shuffle. %D A035491 D. Gale, Mathematical Entertainments: "Careful Card-Shuffling and Cutting Can Create Chaos," The Mathematical Intelligencer, vol. 14, no. 1, 1992, pages 54-56. %D A035491 D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998. %F A035491 T[n, 2*n + 1 - 2*A027383(k)] = 2n - k for all n and k >= 0, A027383(k) <= n. - _M. F. Hasler_, Aug 13 2022 %e A035491 {}, {2, 1}, {3, 2, 4, 1}, {1, 3, 5, 2, 6, 4}, {6, 1, 4, 3, 7, 5, 8, 2}, ... %e A035491 From _M. F. Hasler_, Aug 11 2022: (Start) %e A035491 The first rows of the table are: (sequence = right part of the following table) %e A035491 row | first 2n cards (followed in the deck by 2n+1, 2n+2, ...) %e A035491 ------+--------------------------------------------------------- %e A035491 0 | - (followed by 1, 2, 3, ...) %e A035491 1 | 2 1 (followed by 3, 4, 5, ...) %e A035491 2 | 3 2 4 1 (followed by 5, 6, 7, ...) %e A035491 3 | 1 3 5 2 6 4 (followed by 7, 8, 9, ...) %e A035491 4 | 6 1 4 3 7 5 8 2 (followed by 9, 10, 11, ...) %e A035491 5 | 5 6 8 1 2 4 9 3 10 7 (followed by 11, 12, 13, ...) %e A035491 6 | 9 5 3 6 10 8 7 1 11 2 12 4 (followed by 13, 14, 15, ...) %e A035491 7 | 1 9 11 5 2 3 12 6 4 10 13 8 14 7 (followed by 15, 16, 17, ...) %e A035491 8 | 4 1 10 9 13 11 8 5 14 2 7 3 15 12 16 6 (followed by 17, 18, 19, ...) %e A035491 (...) %e A035491 The largest numbers in row n are 2n - k, located at column 2n + 1 - d(k) with d(k) = 2*A027383(k) = A347789(k+2) = 2, 4, 8, 12, 20, 28, ..., for k >= 0, d(k) <= 2n. (End) %t A035491 Flatten[NestList[riguy, {}, 12]] (* See A035490. *) %o A035491 (PARI) A35491=Map(); d=[]; A035491_row(n)={while(#d<n*2, mapput(A35491,#d\2+1, d=[if(#d < i = i\2+i%2*(#d\2+2), i, d[i])|i<-[1..#d+2]])); mapget(A35491,n)} \\ _M. F. Hasler_, Aug 11 2022 %o A035491 (Python) %o A035491 from itertools import count, islice %o A035491 def agen(): # generator of terms %o A035491 deck = [] %o A035491 for n in count(1): %o A035491 deck += [2*n-1, 2*n] %o A035491 first, next = deck[:n], deck[n:2*n] %o A035491 deck[0:2*n:2], deck[1:2*n:2] = next, first %o A035491 yield from deck %o A035491 print(list(islice(agen(), 90))) # _Michael S. Branicky_, Aug 11 2022 %Y A035491 Cf. A035485, A035490 - A035494. %K A035491 nonn,tabf,nice %O A035491 1,1 %A A035491 _Wouter Meeussen_