Braaaains....

No, I didn't die. I haven't posted on here for a while because I've been pretty busy with things.
Some of them have been negative:

Power outages
Seasonal depression
Stressing out about college applications
Seasonal depression
Studying for midterms and finishing up semester projects
Seasonal depression

Some of them have been positive:

Trying to advertise chess club to people
Trying to get back into drawing
Attempting to learn Mandarin because of Kay peer pressuring me.
Enjoying the HDTV and PS3 that we (my family) all pitched in to get for Christmas.
Treating myself by having a social life.

That last one is actually all that it's hyped up to be, despite what shut-ins like to believe. Sorry, Chao. xD

Anyway, I owe you a math problem, so here:

Aime 2005b, #6


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.

Start by "listing" the cards from top to bottom, to help visualize it:

1
2
3
...
2n

Now, the two piles look like this:

A--------- B

1 ------- n+1
2 ------- n+2
3 ------- n+3
... ............ .......
n -------- 2n

Using the method described above, we can mix them to get the new pile. You may need to work backwards a bit if you want to build it from top to bottom, but it's really nothing hard:

n
2n
n-1
2n-1
....
1
n+1

Now we'll generalize that a certain card is in the same position as the original pile. Again, to visualize, let's line the two up:

n ------- 1
2n ------ 2
n-1 ---- 3
2n-1 --- 4
.... .............
1 --- 2n-1
n+1 -- 2n


There is a very clear pattern here. If you don't see it, then see what this looks like when you only consider the odd numbered cards:

1 ----- n
3 ---- n-1
5 ---- n-2
7 ---- n-3
... ..............
2n-5 --- 3
2n-3 --- 2
2n-1 --- 1

We're looking at the odd numbered cards since our desired card, 131, is odd. If we can make a formula for the xth card up in each column, we can set them equal to 131.

For the first column, this is 2n - (2x - 1)
For the second column, this is x

2n - 2x + 1 = x = 131
2n + 1 = 3x = (131 * 3) = 393
2n = 392

Indeed, 2n is the number of cards in the pile, so our answer is 392.

I find this problem interesting, because you hardly need any math to do it. You just need some logic and some courage to actually try working with it.

On a side note, I very much like this song: