OFFSET
1,1
REFERENCES
D. Gale, Mathematical Entertainments: "Careful Card-Shuffling and Cutting Can Create Chaos," The Mathematical Intelligencer, vol. 14, no. 1, 1992, pages 54-56.
D. Gale, Tracking the Automatic Ant and Other Mathematical Explorations, A Collection of Mathematical Entertainments Columns from The Mathematical Intelligencer, Springer, 1998.
FORMULA
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
EXAMPLE
{}, {2, 1}, {3, 2, 4, 1}, {1, 3, 5, 2, 6, 4}, {6, 1, 4, 3, 7, 5, 8, 2}, ...
From M. F. Hasler, Aug 11 2022: (Start)
The first rows of the table are: (sequence = right part of the following table)
row | first 2n cards (followed in the deck by 2n+1, 2n+2, ...)
------+---------------------------------------------------------
0 | - (followed by 1, 2, 3, ...)
1 | 2 1 (followed by 3, 4, 5, ...)
2 | 3 2 4 1 (followed by 5, 6, 7, ...)
3 | 1 3 5 2 6 4 (followed by 7, 8, 9, ...)
4 | 6 1 4 3 7 5 8 2 (followed by 9, 10, 11, ...)
5 | 5 6 8 1 2 4 9 3 10 7 (followed by 11, 12, 13, ...)
6 | 9 5 3 6 10 8 7 1 11 2 12 4 (followed by 13, 14, 15, ...)
7 | 1 9 11 5 2 3 12 6 4 10 13 8 14 7 (followed by 15, 16, 17, ...)
8 | 4 1 10 9 13 11 8 5 14 2 7 3 15 12 16 6 (followed by 17, 18, 19, ...)
(...)
MATHEMATICA
Flatten[NestList[riguy, {}, 12]] (* See A035490. *)
PROG
(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
(Python)
from itertools import count, islice
def agen(): # generator of terms
deck = []
for n in count(1):
deck += [2*n-1, 2*n]
first, next = deck[:n], deck[n:2*n]
deck[0:2*n:2], deck[1:2*n:2] = next, first
yield from deck
print(list(islice(agen(), 90))) # Michael S. Branicky, Aug 11 2022
CROSSREFS
KEYWORD
nonn,tabf,nice
AUTHOR
STATUS
approved