9/13/17

number 4

Code: SN
P=100
100b+a = 4*25b+a = a (mod 4)
Formulae:
Number N is divisible by 4 iff least significant digit is divisible by 4

Example:
N = 3 45 67 80 is divisible by 4 due 80=4*20.
N = 23 49 01 isn't divisible by 4. 


Code: PU  
P=10 (k=6=2 (mod 4) )
10b+a = (2*4+2)b+a = 2b+a (mod 4)
Formulae:
Number N is divisible by 4 iff 2b+a is divisible by 4

This method is practically the same as first, because P^2=100=4*25
Example:

Number N  = 98764 =
2(     9876)+4 =
2(2(  987+6)+4 =
2(2(2( 98+7)+6)+4 =
2(2(2(2*9+8)+7)+6)+4 =
2(2(2*  2+7)+6)+4 =
2(2*    3+6)+4 =
2*      0+4 = 0 (mod 4)
is divisible by 4.



Code: PD
P=3, (k=1)
3b+a = 4b-b+a = -b+a (mod 4)
Formulae:
Number N is divisible by 4 iff alternating sum of digits is divisible by 4

Example:
P=3
Number N =
 1 0 2 0 0 1 2 0
-1+0-2+0-0+1-2+0 = -4 = 4*(-1)
is divisible by 4.

Number N =
1 0 0 2 1 0 1
1-0+0-2+1-0+1 = 1
isn't divisible by 4.