What are the odds of having all of the Pokemon's trainer ID to match with the number in the lottery in Lumoise city and winning a Master Ball?

>The highest possible ID number in any game is 65535.

Yeah that's the amount of possible IDs. .: The total probability? 1/65535 = 0.00001525902%

Basically, the games cannot generate a number higher than that for the ID Bulbapedia

Now why is it 65535 specifically? >65535 occurs frequently in the field of computing because it is the highest number which can be represented by an unsigned 16-bit binary number.