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.

A346511 a(n) = bitwise XOR of decimal digits of n.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 0, 3, 2, 5, 4, 7, 6, 9, 8, 2, 3, 0, 1, 6, 7, 4, 5, 10, 11, 3, 2, 1, 0, 7, 6, 5, 4, 11, 10, 4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 5, 4, 7, 6, 1, 0, 3, 2, 13, 12, 6, 7, 4, 5, 2, 3, 0, 1, 14, 15, 7, 6, 5, 4, 3, 2, 1, 0, 15, 14, 8, 9, 10
Offset: 0

Views

Author

Jeremias M. Gomes, Jul 21 2021

Keywords

Examples

			a(5) = 5.
a(12) = 1 XOR 2 = 3.
a(425) = 4 XOR 2 XOR 5 = 3.
		

Programs

  • C
    char a(unsigned long long n){
     char p = 0;
     while (n > 0) {p ^= n % 10; n /= 10;}
     return p;}
     // Mia Boudreau, Aug 05 2025
  • Maple
    b:= l-> `if`(l=[], 0, Bits[Xor](l[1], b(subsop(1=[][], l)))):
    a:= n-> b(convert(n, base, 10)):
    seq(a(n), n=0..82);  # Alois P. Heinz, Jul 21 2021
  • Mathematica
    Table[BitXor @@ IntegerDigits[n], {n, 0, 100}] (* Amiram Eldar, Jul 21 2021 *)
  • PARI
    a(n) = my(d=digits(n), k=0); for (i=1, #d, k= bitxor(k, d[i])); k; \\ Michel Marcus, Jul 21 2021
    
  • Sage
    def XOR(a, b):
      return a ^^ b
    [reduce(XOR, map(lambda x: int(x), str(n))) for n in (0..1000)]