Catch rate/Capture method (Generation V)/Shake probability

The formula for b is

b = 65536 / sqrt(sqrt(255/a))

where the divisions and square roots are rounded to the nearest 1/4096, and the final value is rounded down to the nearest whole number.