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.

A086099 a(n) = OR(k AND (n-k): 0<=k<=n), AND and OR bitwise.

Original entry on oeis.org

0, 0, 1, 0, 3, 2, 3, 0, 7, 6, 7, 4, 7, 6, 7, 0, 15, 14, 15, 12, 15, 14, 15, 8, 15, 14, 15, 12, 15, 14, 15, 0, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 16, 31, 30, 31, 28, 31, 30, 31, 24, 31, 30, 31, 28, 31, 30, 31, 0, 63, 62, 63, 60, 63, 62, 63, 56, 63, 62
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 09 2003

Keywords

Comments

a(2^n - 1) = 0, a(3*2^n - 1) = 2^n;
A086100(n) = A007088(a(n)).

Examples

			a(4) = (0 AND 4) OR (1 AND 3) OR (2 AND 2) OR (3 AND 1) OR (4 AND 0) -> (000 AND 100) OR (001 AND 011) OR (010 AND 010) OR (011 AND 001) OR (111 AND 000) = 000 OR 011 OR 010 OR 011 OR 000 = 011 -> a(4)=3.
		

Crossrefs

Cf. A003817 (even bisection), A062383.
Cf. A086100 (in binary), A007088.

Programs

  • Haskell
    import Data.Bits ((.&.), (.|.))
    a086099 n = foldl1 (.|.) $ zipWith (.&.) [0..] $ reverse [0..n] :: Integer
    -- Reinhard Zumkeller, Jun 04 2012
    
  • Mathematica
    a[n_] := BitOr @@ Table[BitAnd[k, n - k], {k, 0, n}]; Table[a[n], {n, 0, 73}] (* Jean-François Alcover, Jun 19 2012 *)
  • PARI
    a(n) = n++; 1<Kevin Ryde, Apr 11 2023

Formula

a(2*n) = 2*2^floor(log_2(n)) - 1 = A003817(n).
a(2*n+1) = 2*a(n).
a(n) = A053644(n+1) - A006519(n+1). - Ridouane Oudra, Apr 09 2023