The daily lives for computer scientists are to create
solutions to problems. The name of our problem that we were presented in class
was called “Penny Piles”. My understanding of the problem is that the left draw
contains 64 pennies and the right draw contains 0 pennies. Thereby, the goal
was to arrive at 48 pennies in one draw. However, there were two rules in which
we were given and they included:
a) If the left draw has an even number of pennies,
half of them can be transferred to the right draw. If the left draw ends up
with an odd number of pennies then operation l is disallowed.
b) If the right draw has an even number of pennies,
half of them can be transferred to the left draw.If the right draw ends up
with an odd number of pennies then operation r is disallowed.
I worked with one of my friends to tackle this problem since
we were suggested to do so. We started
with the 64 pennies in the right draw and 0 in the left. We divided 64 by 2
since it was even and got 32 pennies to transfer to the left draw. This
resulted in both draws having 32 pennies. We divided 32 by 2 once again and transferred
the 16 pennies into the right draw. This resulted in 48 pennies in the right
draw and 16 in the left. We repeated this method until we arrived at odd
numbers of pennies in both draws, 63 in the right and 1 in the left draw. Even
though we arrived at the desired 48 pennies in one draw at the beginning, the
problem was not totally solved.
We tried different numbers in the range [0,64] in which all
of them seemed to work. We tried the different numbers on both sides and we
concluded that it did not matter which side we started from the left or the right
because we arrived at the same answer. If you notice the algorithm, l(left draw) + r(right draw) = 64(total number of pennies)
Comment on how your solutions were like! Have a great week!
