A179081 Parity of sum of digits of n.
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1
Offset: 0
Examples
a(789) = (7+8+9) mod 2 = 0; a(790) = (7+9+0) mod 2 = 0; a(791) = (7+9+1) mod 2 = 1.
Links
Programs
-
Mathematica
Array[Mod[Total[IntegerDigits[#]],2]&,110,0] (* Harvey P. Dale, Feb 20 2013 *)
-
PARI
a(n) = vecsum(digits(n)) % 2 \\ Jeppe Stig Nielsen, Jan 06 2018
Formula
a(n) = if n<10 then (n mod 2) else a([n/10]) XOR (n mod 2).
Comments