Problem 986. Penny Flipping: Reverse subsets of a sequence of coins until you recover the original configuration
I don't understand the first description. For me we obtain :
0 1 2 3 4 5 6
0 1 0 1 0 1 0
0 0 1 0 0 1 0
0 0 0 1 1 1 0
So so PF-1(3) = 6.
Did I miss something ?
Jean-Marie: I think the phrase, "invert the substack" is the issue. For me, this means to take the substack and invert it as a unit. The coins exchange positions in the substack as well as inverting their values. It is a single physical action that translates into two separate operations on the coins. I may have done better to write, "flip the substack as a unit."
Thank you Everett.
Now I understand the second operation, but not the Nth operation (in the example) when you invert all the stack. It's OK between steps 5 and 6 and between steps 8 and 9, but not between steps 2 and 3 (1 0 0 -> 0 1 1 ?).
Jean-Marie: The transformation between steps 2 and 3 (1 0 0 -> 1 1 0) is the same as for the one between steps 8 and 9; we are working with the entire stack of 3 coins. The first/top coin exchanges with the last/bottom coin and then all coins change their orientation.
Every i-th step, imagine that we are picking the top i-coins with our fingers and fliping them upside down. That's FP-1. FP-2 does similar, but, instead of always picking the top i-coins, it alternates between top i-coins and bottom i+1-coins.
Problem Recent Solvers11
Find the alphabetic word product
Combinations without using nchoosek
Change the sign of even index entries of the reversed vector
Multiples of a Number in a Given Range
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!