If we define momentum, p=gamma factor* rest mass* velocity(1), then for photon we get some indeterminate momentum which is 0/0.

But the formula E=(rest mass^2*c^4+p^2c^2)^0.5 gives for photon p=E/c(2). And from equation E=h*c/lamda, we get an energy which is finite and then using (2) we get the momentum.

If equation(1) gives photon's momentum in an indeterminate form which is not true, then why should be momentum defined that way?

Or is it for photon (1) doesn't work?