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.

A283998 a(n) = n AND A005187(floor(n/2)), where AND is bitwise-and (A004198).

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 4, 4, 0, 1, 8, 8, 8, 8, 10, 11, 0, 1, 16, 16, 16, 16, 18, 19, 16, 16, 18, 19, 24, 25, 26, 26, 0, 1, 32, 32, 32, 32, 34, 35, 32, 32, 34, 35, 40, 41, 42, 42, 32, 32, 34, 35, 48, 49, 50, 50, 48, 49, 50, 50, 56, 56, 56, 57, 0, 1, 64, 64, 64, 64, 66, 67, 64, 64, 66, 67, 72, 73, 74, 74, 64, 64, 66, 67, 80, 81, 82, 82, 80, 81, 82, 82, 88, 88, 88, 89
Offset: 0

Views

Author

Antti Karttunen, Mar 19 2017

Keywords

Crossrefs

Programs

  • Mathematica
    A[n_]:=2*n - DigitCount[2*n, 2, 1];Table[BitAnd[n, A[Floor[n/2]]], {n, 0, 100}] (* Indranil Ghosh, Mar 25 2017 *)
  • PARI
    b(n) = if(n<1, 0, b(n\2) + n%2);
    A(n) = 2*n - b(2*n);
    for(n=0, 100, print1(bitand(n, A(floor(n/2))),", ")) \\ Indranil Ghosh, Mar 25 2017
    
  • Python
    def A(n): return 2*n - bin(2*n)[2:].count("1")
    print([n&A(n//2) for n in range(101)]) # Indranil Ghosh, Mar 25 2017
  • Scheme
    (define (A283998 n) (A004198bi n (A005187 (floor->exact (/ n 2))))) ;; Where A004198bi implements bitwise-AND (A004198).
    

Formula

a(n) = n AND A005187(floor(n/2)), where AND is bitwise-and (A004198).
a(n) = A283996(n) - A283997(n).
a(n) = A005187(n) - A283996(n) = (A005187(n) - A283997(n))/2.