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.

A283996 a(n) = n OR A005187(floor(n/2)), where OR is bitwise-or (A003986).

Original entry on oeis.org

0, 1, 3, 3, 7, 7, 6, 7, 15, 15, 10, 11, 14, 15, 15, 15, 31, 31, 18, 19, 22, 23, 23, 23, 30, 31, 31, 31, 29, 29, 30, 31, 63, 63, 34, 35, 38, 39, 39, 39, 46, 47, 47, 47, 45, 45, 46, 47, 62, 63, 63, 63, 53, 53, 54, 55, 61, 61, 62, 63, 60, 61, 63, 63, 127, 127, 66, 67, 70, 71, 71, 71, 78, 79, 79, 79, 77, 77, 78, 79, 94, 95, 95, 95, 85, 85, 86, 87, 93, 93, 94, 95
Offset: 0

Views

Author

Antti Karttunen, Mar 19 2017

Keywords

Crossrefs

Programs

  • Mathematica
    A[n_]:=2*n - DigitCount[2*n, 2, 1]; Table[BitOr[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(bitor(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 (A283996 n) (A003986bi n (A005187 (floor->exact (/ n 2))))) ;; Where A003986bi implements bitwise-OR (A003986).
    

Formula

a(n) = n OR A005187(floor(n/2)), where OR is bitwise-or (A003986).
a(n) = A283997(n) + A283998(n).
a(n) = A005187(n) - A283998(n).