%I #17 Aug 15 2022 10:27:48
%S 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 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 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 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 D. Gale, Mathematical Entertainments: "Careful Card-Shuffling and Cutting Can Create Chaos," The Mathematical Intelligencer, vol. 14, no. 1, 1992, pages 54-56.
%D D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998.
%F 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 {}, {2, 1}, {3, 2, 4, 1}, {1, 3, 5, 2, 6, 4}, {6, 1, 4, 3, 7, 5, 8, 2}, ...
%e From _M. F. Hasler_, Aug 11 2022: (Start)
%e The first rows of the table are: (sequence = right part of the following table)
%e row | first 2n cards (followed in the deck by 2n+1, 2n+2, ...)
%e ------+---------------------------------------------------------
%e 0 | - (followed by 1, 2, 3, ...)
%e 1 | 2 1 (followed by 3, 4, 5, ...)
%e 2 | 3 2 4 1 (followed by 5, 6, 7, ...)
%e 3 | 1 3 5 2 6 4 (followed by 7, 8, 9, ...)
%e 4 | 6 1 4 3 7 5 8 2 (followed by 9, 10, 11, ...)
%e 5 | 5 6 8 1 2 4 9 3 10 7 (followed by 11, 12, 13, ...)
%e 6 | 9 5 3 6 10 8 7 1 11 2 12 4 (followed by 13, 14, 15, ...)
%e 7 | 1 9 11 5 2 3 12 6 4 10 13 8 14 7 (followed by 15, 16, 17, ...)
%e 8 | 4 1 10 9 13 11 8 5 14 2 7 3 15 12 16 6 (followed by 17, 18, 19, ...)
%e (...)
%e 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 Flatten[NestList[riguy, {}, 12]] (* See A035490. *)
%o (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 (Python)
%o from itertools import count, islice
%o def agen(): # generator of terms
%o deck = []
%o for n in count(1):
%o deck += [2*n-1, 2*n]
%o first, next = deck[:n], deck[n:2*n]
%o deck[0:2*n:2], deck[1:2*n:2] = next, first
%o yield from deck
%o print(list(islice(agen(), 90))) # _Michael S. Branicky_, Aug 11 2022
%Y Cf. A035485, A035490 - A035494.
%K nonn,tabf,nice
%O 1,1
%A _Wouter Meeussen_