I've tried chaining before, but wasn't sure how long it'd take so I always ended up quitting before that elusive shiny came. Now I'm wondering how long it would take.

40: The Magic Number

When your chain reaches 40, your chances of encountering shiny patches are maximized at 1 in 200 patches, or 1 in 50 resets (this number is not affected by Static, Magnet Pull, or any other ability). After this point, they will remain constant no matter how high your chain goes. Therefore, if you are looking to catch shiny Pokémon, the goal of your chain is to reach 40, then begin resetting only for shinies. The formula for encountering shiny patches is as follows:

This formula does not work for number exceeding 40. As this formula shows, the probability of encountering a shiny goes down rapidly the farther below 40 the chain is.

So 40 is the magic number. If this isn't the right answer let me know and I'll hide it.

Source: Smogon