Coin removal problem
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I have a slight variation of the coin flipping problem.
There is a line of $n$ coins on the table; some of them are heads up and the rest are tails up, in no particular
order. The object of the puzzle is to remove all the coins by a sequence of moves. On each move, one can
remove any head-up coin, after which its neighboring coin or coins, if any, must be turned over. Coins are
considered âÂÂneighborsâ if they are next to each other in the original line; if there is a gap between coins after
some moves, the coins are no longer considered neighbors.
Determine the property of the starting line that is necessary and sufficient for the puzzle to have a
solution. For those lines that can be removed by the puzzleâÂÂs rules, design a method for doing so.
mathematics logical-deduction coins
New contributor
add a comment |Â
up vote
3
down vote
favorite
I have a slight variation of the coin flipping problem.
There is a line of $n$ coins on the table; some of them are heads up and the rest are tails up, in no particular
order. The object of the puzzle is to remove all the coins by a sequence of moves. On each move, one can
remove any head-up coin, after which its neighboring coin or coins, if any, must be turned over. Coins are
considered âÂÂneighborsâ if they are next to each other in the original line; if there is a gap between coins after
some moves, the coins are no longer considered neighbors.
Determine the property of the starting line that is necessary and sufficient for the puzzle to have a
solution. For those lines that can be removed by the puzzleâÂÂs rules, design a method for doing so.
mathematics logical-deduction coins
New contributor
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I have a slight variation of the coin flipping problem.
There is a line of $n$ coins on the table; some of them are heads up and the rest are tails up, in no particular
order. The object of the puzzle is to remove all the coins by a sequence of moves. On each move, one can
remove any head-up coin, after which its neighboring coin or coins, if any, must be turned over. Coins are
considered âÂÂneighborsâ if they are next to each other in the original line; if there is a gap between coins after
some moves, the coins are no longer considered neighbors.
Determine the property of the starting line that is necessary and sufficient for the puzzle to have a
solution. For those lines that can be removed by the puzzleâÂÂs rules, design a method for doing so.
mathematics logical-deduction coins
New contributor
I have a slight variation of the coin flipping problem.
There is a line of $n$ coins on the table; some of them are heads up and the rest are tails up, in no particular
order. The object of the puzzle is to remove all the coins by a sequence of moves. On each move, one can
remove any head-up coin, after which its neighboring coin or coins, if any, must be turned over. Coins are
considered âÂÂneighborsâ if they are next to each other in the original line; if there is a gap between coins after
some moves, the coins are no longer considered neighbors.
Determine the property of the starting line that is necessary and sufficient for the puzzle to have a
solution. For those lines that can be removed by the puzzleâÂÂs rules, design a method for doing so.
mathematics logical-deduction coins
mathematics logical-deduction coins
New contributor
New contributor
edited 21 mins ago
Glorfindel
11.6k34473
11.6k34473
New contributor
asked 1 hour ago
Jonathan
1163
1163
New contributor
New contributor
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
2
down vote
Let $h$ be the number of heads-up coins. If $h=0$,
We have no starting moves so no solution available.
If $h=1$,
The solution is trivial. Flip the one heads-up coin, after which we have on both sides either a smaller line with $h=1$, or no line at all if the heads-up coin was at either end to start with.
If $h=2$,
There is no solution. There is no move which would bring the number of coins in the current continuous line from 2 to 1. If the heads-up coins are next to each other, flipping either one will leave a tails-up coin with no heads-up coins left. And if there is a gap, flipping either one will create a smaller continuous line with $h=2$ and a gap which is one smaller. Eventually you get to a position where the heads-up coins are next to each other.
If $h=3$,
This is always solvable. If the three heads-up coins are next to each other, we can remove the left-most one, leaving the current line with $h=1$. On the left-hand side of the created gap we either have nothing (if the flipped coin was on the edge) or a separate line with $h=1$, so both sides are solvable.
...TTTTHHHTTTT...
Flip the left-most one
...TTTH THTTTT... (both parts are solvable with $h=1$)
For any odd $h$,
We can always "move" the left-most heads-up coin right with the aforementioned process until we have two heads-up coins next to each other on the left side. When we flip those, we're left with $h_new=h-2$, eventually reaching 1.
For any even $h$,
I think these are always unsolvable.
Let's say $h$ is even and take a look at an arbitrary heads-up coin H. If we look at the sub-lines on the right and left side of H. Since $h$is even, one of the sub-lines has to have an even number of heads-up coins and one of them an odd number. When we flip H, one of the coins in the odd sub-line is flipped, resulting in a sub-line with an even number of heads-up coins. This can be zero, but in this case there is always at least one tails-up coin remaining (the one we flipped on our last move). So there is no way to make both sub-lines solvable after the flip.
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
add a comment |Â
up vote
1
down vote
The row of coins can be fully removed if it has the following property:
It has an odd number of heads
Proof:
By induction.
The property obviously correctly predicts solvability for a row of length 1, where "H" is solvable and "T" is not.
Suppose the property correctly predicts solvability for the row lengths $1$ to $n$.
Case 1: A row of $n+1$ coins with an odd number of heads.
Do a move on the last heads coin, which is at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If the row to the right is non-empty, it will have one head (at location $m+1$ that you flipped) and the rest tails, so it is solvable by the induction hypothesis. The row to the left will also have an odd number of coins because before the flip it had en even number, so that is also solvable by the induction hypothesis. Therefore the original row of $n+1$ coins is solvable.
Case 2: A row of $n+1$ coins with an even number of heads.
Do a move on any heads coin, at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If either of the two rows is empty ($m=1$ or $m=n+1$), then we have a single row of $n$ coins that still has an even number of heads (one removed, and and coin flipped), so it is unsolvable by the induction hypothesis.
If you really do have two rows now, then one of the rows will have an even number, the other will have an odd number of heads. You can think of the move as flipping three coins in a row (the middle of which was heads) and then removing the middle tails coin to split the row. Flipping the three coins changes the parity of the number of heads to odd, and splitting the row then means that exactly one of the resulting rows must be odd and one even. By the induction hypothesis, one of these rows is not solvable.
The coins become unsolvable whichever move you make, so the original row was unsolvable.
By induction, the property correctly predicts solvability for all values of $n$.
add a comment |Â
up vote
1
down vote
It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
Let $h$ be the number of heads-up coins. If $h=0$,
We have no starting moves so no solution available.
If $h=1$,
The solution is trivial. Flip the one heads-up coin, after which we have on both sides either a smaller line with $h=1$, or no line at all if the heads-up coin was at either end to start with.
If $h=2$,
There is no solution. There is no move which would bring the number of coins in the current continuous line from 2 to 1. If the heads-up coins are next to each other, flipping either one will leave a tails-up coin with no heads-up coins left. And if there is a gap, flipping either one will create a smaller continuous line with $h=2$ and a gap which is one smaller. Eventually you get to a position where the heads-up coins are next to each other.
If $h=3$,
This is always solvable. If the three heads-up coins are next to each other, we can remove the left-most one, leaving the current line with $h=1$. On the left-hand side of the created gap we either have nothing (if the flipped coin was on the edge) or a separate line with $h=1$, so both sides are solvable.
...TTTTHHHTTTT...
Flip the left-most one
...TTTH THTTTT... (both parts are solvable with $h=1$)
For any odd $h$,
We can always "move" the left-most heads-up coin right with the aforementioned process until we have two heads-up coins next to each other on the left side. When we flip those, we're left with $h_new=h-2$, eventually reaching 1.
For any even $h$,
I think these are always unsolvable.
Let's say $h$ is even and take a look at an arbitrary heads-up coin H. If we look at the sub-lines on the right and left side of H. Since $h$is even, one of the sub-lines has to have an even number of heads-up coins and one of them an odd number. When we flip H, one of the coins in the odd sub-line is flipped, resulting in a sub-line with an even number of heads-up coins. This can be zero, but in this case there is always at least one tails-up coin remaining (the one we flipped on our last move). So there is no way to make both sub-lines solvable after the flip.
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
add a comment |Â
up vote
2
down vote
Let $h$ be the number of heads-up coins. If $h=0$,
We have no starting moves so no solution available.
If $h=1$,
The solution is trivial. Flip the one heads-up coin, after which we have on both sides either a smaller line with $h=1$, or no line at all if the heads-up coin was at either end to start with.
If $h=2$,
There is no solution. There is no move which would bring the number of coins in the current continuous line from 2 to 1. If the heads-up coins are next to each other, flipping either one will leave a tails-up coin with no heads-up coins left. And if there is a gap, flipping either one will create a smaller continuous line with $h=2$ and a gap which is one smaller. Eventually you get to a position where the heads-up coins are next to each other.
If $h=3$,
This is always solvable. If the three heads-up coins are next to each other, we can remove the left-most one, leaving the current line with $h=1$. On the left-hand side of the created gap we either have nothing (if the flipped coin was on the edge) or a separate line with $h=1$, so both sides are solvable.
...TTTTHHHTTTT...
Flip the left-most one
...TTTH THTTTT... (both parts are solvable with $h=1$)
For any odd $h$,
We can always "move" the left-most heads-up coin right with the aforementioned process until we have two heads-up coins next to each other on the left side. When we flip those, we're left with $h_new=h-2$, eventually reaching 1.
For any even $h$,
I think these are always unsolvable.
Let's say $h$ is even and take a look at an arbitrary heads-up coin H. If we look at the sub-lines on the right and left side of H. Since $h$is even, one of the sub-lines has to have an even number of heads-up coins and one of them an odd number. When we flip H, one of the coins in the odd sub-line is flipped, resulting in a sub-line with an even number of heads-up coins. This can be zero, but in this case there is always at least one tails-up coin remaining (the one we flipped on our last move). So there is no way to make both sub-lines solvable after the flip.
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
add a comment |Â
up vote
2
down vote
up vote
2
down vote
Let $h$ be the number of heads-up coins. If $h=0$,
We have no starting moves so no solution available.
If $h=1$,
The solution is trivial. Flip the one heads-up coin, after which we have on both sides either a smaller line with $h=1$, or no line at all if the heads-up coin was at either end to start with.
If $h=2$,
There is no solution. There is no move which would bring the number of coins in the current continuous line from 2 to 1. If the heads-up coins are next to each other, flipping either one will leave a tails-up coin with no heads-up coins left. And if there is a gap, flipping either one will create a smaller continuous line with $h=2$ and a gap which is one smaller. Eventually you get to a position where the heads-up coins are next to each other.
If $h=3$,
This is always solvable. If the three heads-up coins are next to each other, we can remove the left-most one, leaving the current line with $h=1$. On the left-hand side of the created gap we either have nothing (if the flipped coin was on the edge) or a separate line with $h=1$, so both sides are solvable.
...TTTTHHHTTTT...
Flip the left-most one
...TTTH THTTTT... (both parts are solvable with $h=1$)
For any odd $h$,
We can always "move" the left-most heads-up coin right with the aforementioned process until we have two heads-up coins next to each other on the left side. When we flip those, we're left with $h_new=h-2$, eventually reaching 1.
For any even $h$,
I think these are always unsolvable.
Let's say $h$ is even and take a look at an arbitrary heads-up coin H. If we look at the sub-lines on the right and left side of H. Since $h$is even, one of the sub-lines has to have an even number of heads-up coins and one of them an odd number. When we flip H, one of the coins in the odd sub-line is flipped, resulting in a sub-line with an even number of heads-up coins. This can be zero, but in this case there is always at least one tails-up coin remaining (the one we flipped on our last move). So there is no way to make both sub-lines solvable after the flip.
Let $h$ be the number of heads-up coins. If $h=0$,
We have no starting moves so no solution available.
If $h=1$,
The solution is trivial. Flip the one heads-up coin, after which we have on both sides either a smaller line with $h=1$, or no line at all if the heads-up coin was at either end to start with.
If $h=2$,
There is no solution. There is no move which would bring the number of coins in the current continuous line from 2 to 1. If the heads-up coins are next to each other, flipping either one will leave a tails-up coin with no heads-up coins left. And if there is a gap, flipping either one will create a smaller continuous line with $h=2$ and a gap which is one smaller. Eventually you get to a position where the heads-up coins are next to each other.
If $h=3$,
This is always solvable. If the three heads-up coins are next to each other, we can remove the left-most one, leaving the current line with $h=1$. On the left-hand side of the created gap we either have nothing (if the flipped coin was on the edge) or a separate line with $h=1$, so both sides are solvable.
...TTTTHHHTTTT...
Flip the left-most one
...TTTH THTTTT... (both parts are solvable with $h=1$)
For any odd $h$,
We can always "move" the left-most heads-up coin right with the aforementioned process until we have two heads-up coins next to each other on the left side. When we flip those, we're left with $h_new=h-2$, eventually reaching 1.
For any even $h$,
I think these are always unsolvable.
Let's say $h$ is even and take a look at an arbitrary heads-up coin H. If we look at the sub-lines on the right and left side of H. Since $h$is even, one of the sub-lines has to have an even number of heads-up coins and one of them an odd number. When we flip H, one of the coins in the odd sub-line is flipped, resulting in a sub-line with an even number of heads-up coins. This can be zero, but in this case there is always at least one tails-up coin remaining (the one we flipped on our last move). So there is no way to make both sub-lines solvable after the flip.
edited 9 mins ago
answered 22 mins ago
jafe
8,96119100
8,96119100
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
add a comment |Â
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
Can you please clarify the case for h=3. I'm not quite understanding it. Plus, i think there's a typo.
â Jonathan
17 mins ago
add a comment |Â
up vote
1
down vote
The row of coins can be fully removed if it has the following property:
It has an odd number of heads
Proof:
By induction.
The property obviously correctly predicts solvability for a row of length 1, where "H" is solvable and "T" is not.
Suppose the property correctly predicts solvability for the row lengths $1$ to $n$.
Case 1: A row of $n+1$ coins with an odd number of heads.
Do a move on the last heads coin, which is at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If the row to the right is non-empty, it will have one head (at location $m+1$ that you flipped) and the rest tails, so it is solvable by the induction hypothesis. The row to the left will also have an odd number of coins because before the flip it had en even number, so that is also solvable by the induction hypothesis. Therefore the original row of $n+1$ coins is solvable.
Case 2: A row of $n+1$ coins with an even number of heads.
Do a move on any heads coin, at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If either of the two rows is empty ($m=1$ or $m=n+1$), then we have a single row of $n$ coins that still has an even number of heads (one removed, and and coin flipped), so it is unsolvable by the induction hypothesis.
If you really do have two rows now, then one of the rows will have an even number, the other will have an odd number of heads. You can think of the move as flipping three coins in a row (the middle of which was heads) and then removing the middle tails coin to split the row. Flipping the three coins changes the parity of the number of heads to odd, and splitting the row then means that exactly one of the resulting rows must be odd and one even. By the induction hypothesis, one of these rows is not solvable.
The coins become unsolvable whichever move you make, so the original row was unsolvable.
By induction, the property correctly predicts solvability for all values of $n$.
add a comment |Â
up vote
1
down vote
The row of coins can be fully removed if it has the following property:
It has an odd number of heads
Proof:
By induction.
The property obviously correctly predicts solvability for a row of length 1, where "H" is solvable and "T" is not.
Suppose the property correctly predicts solvability for the row lengths $1$ to $n$.
Case 1: A row of $n+1$ coins with an odd number of heads.
Do a move on the last heads coin, which is at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If the row to the right is non-empty, it will have one head (at location $m+1$ that you flipped) and the rest tails, so it is solvable by the induction hypothesis. The row to the left will also have an odd number of coins because before the flip it had en even number, so that is also solvable by the induction hypothesis. Therefore the original row of $n+1$ coins is solvable.
Case 2: A row of $n+1$ coins with an even number of heads.
Do a move on any heads coin, at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If either of the two rows is empty ($m=1$ or $m=n+1$), then we have a single row of $n$ coins that still has an even number of heads (one removed, and and coin flipped), so it is unsolvable by the induction hypothesis.
If you really do have two rows now, then one of the rows will have an even number, the other will have an odd number of heads. You can think of the move as flipping three coins in a row (the middle of which was heads) and then removing the middle tails coin to split the row. Flipping the three coins changes the parity of the number of heads to odd, and splitting the row then means that exactly one of the resulting rows must be odd and one even. By the induction hypothesis, one of these rows is not solvable.
The coins become unsolvable whichever move you make, so the original row was unsolvable.
By induction, the property correctly predicts solvability for all values of $n$.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
The row of coins can be fully removed if it has the following property:
It has an odd number of heads
Proof:
By induction.
The property obviously correctly predicts solvability for a row of length 1, where "H" is solvable and "T" is not.
Suppose the property correctly predicts solvability for the row lengths $1$ to $n$.
Case 1: A row of $n+1$ coins with an odd number of heads.
Do a move on the last heads coin, which is at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If the row to the right is non-empty, it will have one head (at location $m+1$ that you flipped) and the rest tails, so it is solvable by the induction hypothesis. The row to the left will also have an odd number of coins because before the flip it had en even number, so that is also solvable by the induction hypothesis. Therefore the original row of $n+1$ coins is solvable.
Case 2: A row of $n+1$ coins with an even number of heads.
Do a move on any heads coin, at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If either of the two rows is empty ($m=1$ or $m=n+1$), then we have a single row of $n$ coins that still has an even number of heads (one removed, and and coin flipped), so it is unsolvable by the induction hypothesis.
If you really do have two rows now, then one of the rows will have an even number, the other will have an odd number of heads. You can think of the move as flipping three coins in a row (the middle of which was heads) and then removing the middle tails coin to split the row. Flipping the three coins changes the parity of the number of heads to odd, and splitting the row then means that exactly one of the resulting rows must be odd and one even. By the induction hypothesis, one of these rows is not solvable.
The coins become unsolvable whichever move you make, so the original row was unsolvable.
By induction, the property correctly predicts solvability for all values of $n$.
The row of coins can be fully removed if it has the following property:
It has an odd number of heads
Proof:
By induction.
The property obviously correctly predicts solvability for a row of length 1, where "H" is solvable and "T" is not.
Suppose the property correctly predicts solvability for the row lengths $1$ to $n$.
Case 1: A row of $n+1$ coins with an odd number of heads.
Do a move on the last heads coin, which is at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If the row to the right is non-empty, it will have one head (at location $m+1$ that you flipped) and the rest tails, so it is solvable by the induction hypothesis. The row to the left will also have an odd number of coins because before the flip it had en even number, so that is also solvable by the induction hypothesis. Therefore the original row of $n+1$ coins is solvable.
Case 2: A row of $n+1$ coins with an even number of heads.
Do a move on any heads coin, at location $m$. This leaves a row of coins to the left of length $m-1$, and a row to the right of length $n-m+1$. If either of the two rows is empty ($m=1$ or $m=n+1$), then we have a single row of $n$ coins that still has an even number of heads (one removed, and and coin flipped), so it is unsolvable by the induction hypothesis.
If you really do have two rows now, then one of the rows will have an even number, the other will have an odd number of heads. You can think of the move as flipping three coins in a row (the middle of which was heads) and then removing the middle tails coin to split the row. Flipping the three coins changes the parity of the number of heads to odd, and splitting the row then means that exactly one of the resulting rows must be odd and one even. By the induction hypothesis, one of these rows is not solvable.
The coins become unsolvable whichever move you make, so the original row was unsolvable.
By induction, the property correctly predicts solvability for all values of $n$.
edited 10 mins ago
answered 18 mins ago
Jaap Scherphuis
13k12258
13k12258
add a comment |Â
add a comment |Â
up vote
1
down vote
It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)
add a comment |Â
up vote
1
down vote
It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)
add a comment |Â
up vote
1
down vote
up vote
1
down vote
It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)
It looks like a line is solvable if and only if
there is an odd number of heads in the line
and the strategy to solve the puzzle is to make sure
that whenever you take away a head, the remaining sub-lines each have an odd number of heads.
I'm on mobile right now and can't type a rigorous mathematical proof; moreover, two other users seem to be doing this so I'm going to spend that time upvoting their answers instead :)
edited 5 mins ago
answered 21 mins ago
Glorfindel
11.6k34473
11.6k34473
add a comment |Â
add a comment |Â
Jonathan is a new contributor. Be nice, and check out our Code of Conduct.
Jonathan is a new contributor. Be nice, and check out our Code of Conduct.
Jonathan is a new contributor. Be nice, and check out our Code of Conduct.
Jonathan is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fpuzzling.stackexchange.com%2fquestions%2f74208%2fcoin-removal-problem%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password