cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A179081 Parity of sum of digits of n.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Jun 28 2010

Keywords

Comments

a(n) = A000035(A007953(n));
characteristic function of numbers with an odd sum of digits in their decimal representation:
a(A054684(n)) = 1; a(A054683(n)) = 0;
a(A179083(n)) = a(A179085(n)) = 1;
a(A179082(n)) = a(A179084(n)) = 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.
		

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).