The bird can fly infinitely many times.
There are two trains, red and purple, moving to each other with velocities v1 and v2 respectively. The distance between them is D.
A bird is sitting on the top of a bar near red train. The bird flies with v3 velocity where v3 > v1 and v3 > v2. The bird has to fly from red to purple train and fly back from purple to red.
The question is: How many times the bird can fly in between these two moving trains until the trains reach to each other? (see the image)
(I heard that this problem is associated to Gauss, since he couldn't perfectly solve this. Is that true?)
As alexmahone says, the bird will (because we are assuming the bird can fly infinitesmal distances repeatedly) fly back and forth an infinite number of times. It is more common to ask for the total distance the bird can fly. You could, of course, find the distance by summing that infinite series. It is far simpler to argue that the two trains are closing at speed v1+ v2 and so will take time D/(v1+v2) to close the distance, D, between them. During that time, the bird, of course, flew distance Dv3/(v1+ v2).
There is a famous story about this problem. A mathematician posed this problem to VonNeumann (or Wiener or whatever brilliant mathematician you wish). He thought for just a moment and gave the correct answer without writing anything. The mathematician chuckled and said, "you know, some people try to do that as an infinite series." VonNeumann looked puzzled and responded "but I did sum an infinite series"!