Oh right I think I forgot to mention that after 40, the value of 'n' does not go any higher. Meaning 40 is the cap, and 41 would still be counted as 40 (otherwise the denominator will become zero and the world would explode xD). And the chance for getting a shiny at 40 is *ahem* 0.50151824951172% , approximately 1 out of 20 pokemon.