Flipping Pancakes


4.2 ( 5802 ratings )
Jeux Casse-tête Stratégie
Développeur Arka Roy Chowdhury
Libre

This is a game of 0s and 1s. Flip the pancakes to generate a series of binary strings. The objective of the game is to make all the elements of the string 1.
How many flips did it take you to turn all the sides of the pancakes red?

Can you calculate the minimum number of flips required to generate a string of all 1s using “N” number of pancakes?

Here is an interesting exercise for the mathematically inclined souls.
You may already have noted that the string is of 2n length with n being the number of pancakes in the stack.
Convert the string into decimal system numbers.
You will note that the string always starts with decimal 1. (0001=1 for a stack of 2, 000001=1 for a stack of 3 etc)
When you reach your objective, that is when you turn all the elements to 1 you would have a decimal number 2^2n – 1. (1111=2^2.2-1 for a stack of 2, 111111=2^2.3-1 for a stack of 3)
Here is the interesting part.
Try to generate maximum number of integers between 1 to 2^2n-1.
Can you generate all integers?