Let me list the game and then I will pose my question.
A game called finding Ace is described as follows. Given a pack of 13 cards of the same suit picked from a shuffled deck, we are going to find the Ace in the following way. Let the left most end be the top. If the card on the top is 1 (i.e., Ace), then the game is over. Otherwise, check the number on the top card, say n, then remove the first n cards from the pack and put them back in the reverse order. Repeat the process until Ace surfaces to the top.
Example:
D7 D13 D10 D4 D5 D1 D6 D2 D12 D11 D9 D3 D8
D6 D1 D5 D4 D10 D13 D7 D2 D12 D11 D9 D3 D8
D13 D10 D4 D5 D1 D6 D7 D2 D12 D11 D9 D3 D8
D8 D3 D9 D11 D12 D2 D7 D6 D1 D5 D4 D10 D13
D6 D7 D2 D12 D11 D9 D3 D8 D1 D5 D4 D10 D13
D9 D11 D12 D2 D7 D6 D3 D8 D1 D5 D4 D10 D13
D1 D8 D3 D6 D7 D2 D12 D11 D9 D5 D4 D10 D13
Reverse 6 times.
My question: What is the absolute maximum number of reverses it would take to move the ace to the top?
I wrote a program that would play this game and then ran it a billion times to see the results.
The highest number of reverses the program found was 79.
I am going to edit my code to list the original arrangement of the game that takes the most reverses, I just have not gotten around to it. Maybe that will give a clue as to if there is an arrangement that would take more reverses than 79.
I know this may not be the actual maximum because there are over 6 billion arrangements possible, while I have checked less than a billion.
Hopefully someone has a simple solution to compute the most reverses needed.
Thanks all!
I'm not able to do a proof of the maximum number of reverse operations but ...
Try:
After reversing 8o times it will be
@Michael listed the solutions from 2 to 10 (https://math.stackexchange.com/a/2650497/315401). Below is a few more solutions.
11 cards: 51 steps $( 4, 9, 11, 6, 10, 7, 8, 2, 1, 3, 5 )$
12 cards: 65 steps $(2, 6, 1, 10, 11, 8, 12, 3, 4, 7, 9, 5)$
13 cards: 80 steps $(2, 9, 4, 5, 11, 12, 10, 1, 8, 13, 3, 6, 7)$