999 = 37 * 27
9999 = 99 * 101
999999 = 999* 1001 = 999 * 11 * 91 = 999 * 11 * 13 * 7
2004 is a multiple of 3, 4 and 6.
The given number can be divided into groups of three 9's, four 9's or six 9's at a time.
The given number is divisible by 7, 13, 37 and 101.

Let assume length of the train is ‘L’ and speed of train = a.
Speed of man 1 = b.
Speed of man 2 = c.
20 = L / a – b.
18 = L / a + c.
18a + 18c = 20a – 20b.
a = 10b + 9c.
Distance of two men = 600 x (a + c).
Time = 600(a+c) – 600(b+c) / (b+c)
= 600 ( a – b) / (b + c)
= 600 (10b + 10c – b) / (b + c)
= 5400 seconds
= 90 min (ans)

@sumit-agarwal
In such scenarios like finding distinct values of [x^2/n] where x can be from 1, 2, 3 ... n[1^2/n], [2^2/n] ... [(n/2)^2/n] will yield all numbers from 0 to [n/4] (means [n/4] + 1 distinct integers)Then the next set (from [(n/2 + 1)^2/n] till [n^2/n] will be all different integers (means [n/2] distinct integers)So the number of distinct integers would be [n/2] + [n/4] + 1
if n = 100,number of distinct integers would be [100/2] + [100/4] + 1 = 76
if n = 2014,number of distinct integers would be [2014/2] + [2014/4] + 1 = 1511
if n = 13number of distinct integers would be [13/2] + [13/4] + 1 = 10
Just trying to generalize a solution shared by Kamal sir (Quant Boosters - Set 1 - Q2).
You can try out with various numbers (may be smaller numbers) so that this can be verified.