@bmay Modulo properties

associative over + : (a + b)%m = (a % m) + (b%m)
For * : (a * b)%m = ((a % m) * (b%m)) % m
(a % m)%m = (a % m)

Applying this to N=(a[0] * 1 + a[1] * 10 + ...a[n] * 10 ^n)

N % 9 = (a[0] * 1 + a[1] * 10 + ...a[n] * 10 ^n) % 9

N % 9 = (a[0] * 1) % 9 + (a[1] * 10)%9 + ... + (a[n] * 10 ^n) % 9

N % 9 = ((a[0] %9) * (1 % 9)) % 9 + ((a[1] %9) * (10 %9))%9 + ... + ( (a[n] %9) * (10 ^n % 9)) % 9

Note that 10^k % 9 = 1, that simplifies

N % 9 = ((a[0] %9) ) % 9 + ((a[1] %9))%9 + ... + ( (a[n] %9)) % 9

N % 9 = (a[0] ) % 9 + (a[1])%9 + ... + ( a[n] ) % 9

Note that a[i]<10, so a[i] % 9 = a[i], thus

N % 9 = (a[0] + a[1] + ..a[n])