Let the number of red apples in the box be x and the number of green apples be y. Then or . Let the number of green apples sold be z so that the number of red apples sold is 2z. Then, at the end, there are x- 2z red apples and y- z green apples or which is the same as 4x= 3y+ z. Of course, we also have (x- 2z)+ (y- z)= x+ y- 3z= 24.
Solve the three equations 6x= 7y, 4x= 3y+ z, and x+ y- 3z= 24 for x, y, and z. The answer to the question "How many apples were in the box at first?" is x+ y.
Are you sure of your numbers? I do NOT get an integer number of apples.