You can decide whether a number is divisible by 3 by forming its cross sum,
that is the sum of all its decimal digits: It is divisible by three exactly if its cross sum is. Similarly, a three-digit number is
divisible by seven if (and only if) the sum of twice its most significant
digit plus three times its middle digit plus its least significant digit is
divisible by seven.
Can you find a similar scheme for checking divisibility by 33 and 37, for numbers with an arbitrary number of digits?
Let N = u0 + u1x10 + u2x10^2 + u3x10^3 + ... + ukx10^k
Then N is evenly divisible by m if and only if
u0 + u1x(10 mod m) + u2x(10^2 mod m) + u3x(10^3 mod m) + ... + ukx(10^k mod m) is divisible by m.
For instance, if m = 33, then
u0 + u1x(10 mod m) + u2x(10^2 mod m) + u3x(10^3 mod m) + ... + ukx(10^k
mod m) = u0 +10*u1 + u2 + 10_u3 + ..., as previously given.
If m = 11, then we can also evaluate u0 +10*u1 + u2 + 10*u3 etc,
but it is computationally easier to subtract 11*u1 + 11*u3 + 11*u5 etc,
giving u0 - u1 + u2 - u3 + u4 ... as the vswitchs "cross sum"