Stack of Cards
Source:
November 13, 2005
Problem Statement
The cards in a stack of cards are numbered consecutively from through from top to bottom. The top cards are removed, kept in order, and form pile . The remaining cards form pile . The cards are then restacked by taking cards alternately from the tops of pile and , respectively. In this process, card number becomes the bottom card of the new stack, card number is on top of this card, and so on, until piles and are exhausted. If, after the restacking process, at least one card from each pile occupies the same position that it occupied in the original stack, the stack is named magical. Find the number of cards in the magical stack in which card number retains its original position.