It's a very nasty divisibility rule. The one for 13 works in the same way, but instead of multiplying by 2, you multiply by 4.
There are actually a couple of well-known rules for that, but these are the easiest to remember IMO.
Well, on the side of easy ones there is "if the last digit is divisible by 2, whole number is divisible by 2". Also works for 5. And if you take last 2 digits, it works for 4. And the legendary "if it ends with 0, it's divisible by 10".
With 17, I understand that you're referring to how 299,999 is also divisible by 17. What is the 51 reference, though? I know there's 3,999,999,999,999 but that starts with a 3. Not the same at all.