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.

A265158 a(1) = 1, a(2*n) = 2*a(n), a(2*n+1) = floor(a(n)/2).

Original entry on oeis.org

1, 2, 0, 4, 1, 0, 0, 8, 2, 2, 0, 0, 0, 0, 0, 16, 4, 4, 1, 4, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 8, 8, 2, 8, 2, 2, 0, 8, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 16, 16, 4, 16, 4, 4, 1, 16, 4, 4, 1, 4, 1, 0, 0, 16, 4, 4, 1, 4, 1, 0
Offset: 1

Views

Author

Reinhard Zumkeller, Dec 04 2015

Keywords

Comments

All terms are either zero or a power of 2;
a(2^k) = 2^k; for k > 1: a(2^k+1) = 2^(k-2); a(2^k-1) = 0;
A264784 gives lengths of runs of zeros.

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a265158 n = a265158_list !! (n-1)
    a265158_list = 1 : concat
       (transpose [map (* 2) a265158_list, map (flip div 2) a265158_list])
    
  • PARI
    a(n) = if (n==1, 1, if (n%2, a(n\2)\2, 2*a(n\2))); \\ Michel Marcus, Jan 22 2022