Problem 44719. Penny Distribution Machine
A machine consists of a row of boxes. To start, one places N pennies in the leftmost box. The machine then redistributes the pennies as follows:
On each iteration, it replaces a pair of pennies in one box with a single penny in the next box to the right. The iterations stop when there is no box with more than one coin. For example, the figure below shows the working of the machine in distributing nine pennies by always selecting a pair of pennies in the leftmost box with at least two coins.
Itr 0: 9 0 0 0 Itr 1: 7 1 0 0 Itr 2: 5 2 0 0 Itr 3: 3 3 0 0 Itr 4: 1 4 0 0 Itr 5: 1 2 1 0 Itr 6: 1 0 2 0 Itr 7: 1 0 0 1
Determine the number of boxes and iterations needed by the machine to distribute N pennies. From the example above, the machine requires four boxes and seven iterations to distribute nine pennies.
Solution Stats
Problem Comments
Solution Comments
Show commentsGroup

Physics
- 18 Problems
- 13 Finishers
- Mechanics 1
- jogging?
- Bouncing disk
- Energy of an object
- Kepler's Equation
- Mechanical Advantage of a Gear Train
- What gear ratio does the cyclist need?
- Bernoulli's Equation
- Juggling
- Find the jerk
- Determine if a four bar mechanism is of Grashof type
- center of mass
- Center of mass
- Elastic Collision 001: 1-D
- Calculate compression ratio of engine
- Distance of the centroids of the balls
- Calculate the height of an object dropped from the sky
- How Far Can You Throw Something?
Problem Recent Solvers22
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!