Ken had three times as many apples as papayas. After selling 160 apples and 25 papayas, he had twice as many papayas as apples left. How many fruits did he have at first?

a = 3p

p-25 = 2(a-160)

a+p = 236

To solve this problem, let's break it down step by step:

Let's assume the number of papayas Ken had at first is x.
According to the problem, Ken had three times as many apples as papayas, so the number of apples he had at first is 3x.

After selling 160 apples, Ken has 3x - 160 apples left.
After selling 25 papayas, Ken has x - 25 papayas left.

The problem states that after selling the fruits, Ken had twice as many papayas as apples left. So, we can write an equation to represent this:

x - 25 = 2(3x - 160)

Let's solve this equation:

x - 25 = 6x - 320
Subtract x from both sides:
-25 = 5x - 320
Add 320 to both sides:
295 = 5x
Divide both sides by 5:
x = 59

Therefore, Ken initially had 59 papayas.

To find the number of apples, we can substitute the value of x into the equation for the number of apples:

3x = 3 * 59 = 177

So, Ken initially had 177 apples.

Finally, to calculate the total number of fruits Ken had at first, we add the number of apples and papayas:

Total fruits = 177 + 59 = 236

Therefore, Ken initially had 236 fruits in total.