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.

A283999 a(n) = A005187(n) XOR A006068(n), where XOR is bitwise-xor (A003987).

Original entry on oeis.org

0, 0, 0, 6, 0, 14, 14, 14, 0, 30, 30, 30, 30, 30, 18, 16, 0, 62, 62, 62, 62, 62, 50, 48, 62, 62, 34, 32, 34, 32, 44, 44, 0, 126, 126, 126, 126, 126, 114, 112, 126, 126, 98, 96, 98, 96, 108, 108, 126, 126, 66, 64, 66, 64, 76, 76, 66, 64, 92, 92, 92, 92, 92, 82, 0, 254, 254, 254, 254, 254, 242, 240, 254, 254, 226, 224, 226, 224, 236, 236, 254, 254, 194, 192, 194
Offset: 0

Views

Author

Antti Karttunen, Mar 20 2017

Keywords

Crossrefs

Programs

  • Mathematica
    Table[BitXor[Fold[BitXor, n, Quotient[n, 2^Range[BitLength@ n - 1]]], 2 n - DigitCount[2 n, 2, 1]], {n, 0, 84}] (* Michael De Vlieger, Mar 20 2017, after Jan Mangaldan at A006068 *)
  • PARI
    b(n) = if(n<1, 0, b(n\2) + n%2);
    A(n) = 2*n - b(2*n);
    a(n) = if(n<2, n, 2*a(floor(n/2)) + (n%2 + a(floor(n/2))%2)%2);
    for(n=0, 110, print1(bitxor(A(n),a(n)),", ")) \\ Indranil Ghosh, Mar 25 2017
    
  • Python
    def A(n): return 2*n - bin(2*n)[2:].count("1")
    def a(n): return n if n<2 else 2*a(n//2) + (n%2 + a(n//2)%2)%2
    print([A(n)^a(n) for n in range(111)]) # Indranil Ghosh, Mar 25 2017
  • Scheme
    (define (A283999 n) (A003987bi (A005187 n) (A006068 n))) ;; Where A003987bi implements bitwise-XOR (A003987).
    

Formula

a(n) = A005187(n) XOR A006068(n), where XOR is bitwise-xor (A003987).
a(n) = A006068(2*n) XOR A283997(2*n).