John and Peter had 96 stamps altogether. After John had given Peter 1/2 of his stamps, Peter then gave John 1/5 of his stamps. In the end, both of them had the same number of stamps each. How many stamps did Peter have at first?

Let's start by setting up some equations to represent the given information.

Let J be the number of stamps John had at first, and let P be the number of stamps Peter had at first.

We know that John and Peter had 96 stamps altogether, so we can write:

J + P = 96

We also know that after John gave Peter 1/2 of his stamps, he was left with only 1/2 of his original amount. That means John gave away 1/2 of his stamps, or (1/2)J stamps. So John's new number of stamps is:

J - (1/2)J = (1/2)J

Similarly, after Peter gave John 1/5 of his stamps, he was left with 4/5 of his original amount. That means Peter gave away 1/5 of his stamps, or (1/5)P stamps. So Peter's new number of stamps is:

P - (1/5)P = (4/5)P

Finally, we are told that after these exchanges, John and Peter had the same number of stamps each. That means:

(1/2)J = (4/5)P

We can use this last equation to solve for one of the variables in terms of the other. For example, we could solve for J:

J = (4/5)(2/1)P
J = (8/5)P

Now we can substitute this expression for J into the first equation we wrote:

(8/5)P + P = 96

Simplifying this equation, we get:

(13/5)P = 96

Multiplying both sides by 5/13 gives us:

P = 360/13

This is approximately equal to 27.69, so we can conclude that Peter had about 27 stamps at first.

Let's work through the problem step by step.

Let's assume that Peter had x stamps at first.

John and Peter had 96 stamps altogether, so John must have had 96 - x stamps.

After John gave Peter half of his stamps, John had 1/2 * (96 - x) stamps left.

Now, Peter has x + 1/2 * (96 - x) stamps.

Peter then gave John 1/5 of his stamps, so Peter has (x + 1/2 * (96 - x)) - 1/5 * (x + 1/2 * (96 - x)) stamps left.

In the end, both of them had the same number of stamps, so we set up the equation:

x + 1/2 * (96 - x) = (x + 1/2 * (96 - x)) - 1/5 * (x + 1/2 * (96 - x))

Let's simplify the equation:

x + 1/2 * (96 - x) = x + 1/2 * (96 - x) - 1/5 * (x + 1/2 * (96 - x))

Multiply through by 10 to remove the fractions:

10x + 5(96 - x) = 10x + 5(96 - x) - 2(x + 1/2 * (96 - x))

Simplifying further:

10x + 480 - 5x = 10x + 480 - 2x - 5(96 - x)

Combining like terms:

5x + 480 = 10x + 480 - 10x - 480 + 5x

Simplifying again:

5x + 480 = 5x

Subtracting 5x from both sides:

480 = 0

This equation is not possible.

Therefore, there is no solution to this problem.