Test for Divisibility by 13
You might also like <i>weighted</i> digit sums.<p>I&#x27;ll copy the example from german Wikipedia article [0] as you might generalize from that easier as when I would write it down in mathematical notation:<p>Here are the weights for 7:<p><pre><code>    1 ≡ 1 (mod 7)
    10 ≡ 3 (mod 7)
    100 ≡ 2 (mod 7)
    1000 ≡ −1 (mod 7)
    10000 ≡ −3 (mod 7)
    100000 ≡ −2 (mod 7)
    1000000 ≡ 1 (mod 7)
    ...
    10^n ≡ a_n (mod 7)
</code></pre>
Then multiply the weights with the digit on the respective position and sum up. Repeat if you like. If the resulting number is divisible by 7, you know that the initial number also was.<p>Example:<p>853629:<p>8x <i>(-2)</i> + 5x <i>(-3)</i> + 3x <i>(-1)</i> + 6x <i>2</i> + 2x <i>3</i> + 9x <i>1</i> = -16-15-3+12+6+9 = -7, therefore 853629 is divisible by 7.<p>[0] <a href="https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;Quersumme#Gewichtete_Quersumme" rel="nofollow">https:&#x2F;&#x2F;de.wikipedia.org&#x2F;wiki&#x2F;Quersumme#Gewichtete_Quersumme</a>