login
Parity of sum of digits of n.
11

%I #10 Jan 07 2018 10:12:33

%S 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,

%T 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,

%U 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

%N Parity of sum of digits of n.

%C a(n) = A000035(A007953(n));

%C characteristic function of numbers with an odd sum of digits in their decimal representation:

%C a(A054684(n)) = 1; a(A054683(n)) = 0;

%C a(A179083(n)) = a(A179085(n)) = 1;

%C a(A179082(n)) = a(A179084(n)) = 0.

%H R. Zumkeller, <a href="/A179081/b179081.txt">Table of n, a(n) for n = 0..10000</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%F a(n) = if n<10 then (n mod 2) else a([n/10]) XOR (n mod 2).

%e a(789) = (7+8+9) mod 2 = 0;

%e a(790) = (7+9+0) mod 2 = 0;

%e a(791) = (7+9+1) mod 2 = 1.

%t Array[Mod[Total[IntegerDigits[#]],2]&,110,0] (* _Harvey P. Dale_, Feb 20 2013 *)

%o (PARI) a(n) = vecsum(digits(n)) % 2 \\ _Jeppe Stig Nielsen_, Jan 06 2018

%K base,nonn

%O 0,1

%A _Reinhard Zumkeller_, Jun 28 2010