Distance between the lens and the retina is 2.5 cm
So v = +2.5 cm
Let us take the first case where the object is kept at 25 cm from the eye.
So u = -25 cm
The Lens formula is 1/f = 1/v - 1/u.
1/f = 1/2.5 - 1/-25
1/f = 11/25
fat 25 cm = ≈ 2.3 cm
Now let us take the second case where the object is kept at close to infinity from the eye.
v = +2.5 cm
u ≈ -∞
The Lens formula is 1/f = 1/v - 1/u.
1/f = 1/2.5 - 1/-∞
u approaches infinity so 1/u approaches 0
1/f = 1/2.5