Two objects coming towards each and then one goes back. How to find the number of trips I saw a question in physics

A car is moving at a constant speed of 40 km/h along a straight road which heads towards a large vertical wall and makes a sharp 90 turn by the side of the wall. A
fly flying at a constant speed of 100 km/h, starts from the wall towards the car at an instant when the car is 20 km away, flies until it reaches the glasspane of the car and return to the wall at the same speed. It continues to fly between the car and the wall till the car makes the 90 degrees turn.
How many trips has it made between the car and the wall?

Solution

Suppose the car is at a distance x away when the fly is at the wall. The time taken by the fly to reach the car is x/(100+40) = x/140. The distance travelled by fly during that time is 100x/140 = 5x/7. Now the fly goes back to the wall which will take 5x/700 = x/140 hours time. By that time,the car travels 40x/140 = 2x/7 km.(3x/7 Km from the wall).
When the 2nd trip of fly towards the car starts, it is at 3x/7 Km from the car.
Now the book says

distance of car at start of 1st trip = $$20$$
distance of car at start of 2nd trip = $$(3/7)×20$$
distance of car at start of 3rd trip = $$(3/7)^2 × 20$$
distance of car at start of 3rd trip = $$(3/7)^3×20$$
Distance of car at start of $$n^{th} trip$$ = $$(3/7)^{n-1}$$
Trips will go on till the distance becomes 0, which will happen when n becomes infinity.
I can't understand understand how can we say about the pattern between the trip number and distance between them?
(PS: The solution I wrote doesn't have the exact words used in the book)
I will be grateful if you could help.
Thank you
 A: As noted in another answer, the simplest way to find the total distance traveled by the fly is to first calculate the total flying time ($30$ minutes), then multiply that by the fly's (constant) speed of $100$ km/h; this gives the correct total distance, which is $50$ km.
Finding the distance per leg of the trip is a little trickier, since there are two types of flight legs: those toward the moving car, and those toward the stationary wall.  To fly to the stationary wall from an initial distance $X$ takes time $X / v_f$, where $v_f=100$ km/h is the fly's speed.  To fly to the moving car from an initial distance $X$, on the other hand, takes time $X/(v_f+v_c)$, where $v_c=40$ km/h is the car's speed.  The distance between the car and the wall is decreased by $t \cdot v_c$ in either case.  So for flights toward the car, $X \rightarrow X - X/(v_f + v_c)\cdot v_c=X\cdot(1- v_c/(v_c+v_f))=(5/7)X$ and the fly travels $(5/7)X$; and for flights toward the wall, $X \rightarrow X - X/v_f\cdot v_c=X\cdot(1-v_c/v_f)=(3/5)X$ and the fly travels $X$.  Putting these together, for each round trip starting at the car, the distance is transformed by $X\rightarrow (3/7)X$ and the fly travels $(10/7)X$.  So the fly's total travel distance is
$$
(20 \text{ km})\cdot\frac{10}{7}\cdot\left(1 + \frac{3}{7}+\left(\frac{3}{7}\right)^2+\left(\frac{3}{7}\right)^3+\ldots\right)=(20 \text{ km})\cdot\frac{10}{7}\cdot\frac{7}{4}=50 \text{ km}.
$$
A: The car is going at 40 km/h and is at 20 km from the wall. So it will run for 30 minutes before reaching it. The fly is going at constant 100 km/h so it will cover 50 km in 30 minutes, regardless of which direction it goes. Simpler way to solve for the total distance covered by the fly.
A: this is one of the hypothetical cases, they have assumed the fly to be point size. you have to also consider the rounds when the distance between the car and the fly is infinitesimally small. So, even though fly only has 30 minutes to travel, it will make infinite trips since you have to consider all those infinitesimally small distances.
as mentioned in the last part of your question the distance between the car and the wall during the nth trip =  (3/7)^(n-1) *20  . since 3/7 is less than 1 it will become 0 when n approaches infinity, hence it will take infinite trips for distance to become zero.
if there is confusion in any line feel free to mention it.
