Code: PS, PU in decimal system with k=8=0 (mod 2)
P is even
Formulae:
Number N is divisible by 2 iff least significant digit is divisible by 2 (even)
Example:
P=10
They are digits divisible by 2: 0, 2, 4, 6, 8
Number N = 9876543210 is divisible by 2.
P=2
Number N=1010000110110001 isn't divisible by 2.
Code: PS, PD in P=3 with k=1
P is odd
Formulae:
Number N is divisible by 2 iff sum parity of digits is even
Example:
P=9
Number N =
8 7 6 5 4 3 2 1 0
0+1+0+1+0+1+0+1+0 = 4 = 2*2
Number is even. It's divisible by 2.
P = 11
Number N =
6 5 4 3 10 9 8 7 1 2 0
0+1+0+1+ 0+1+0+1+1+0+0 = 5 (parity of digits)
Number 5 is odd. Number N isn't divisible by 2.