login
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.
6
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, 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, 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
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, ...)
(...)
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)
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
STATUS
approved