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.
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office