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.

A105186 Replace odd-positioned digits with 0 in ternary representation of n.

Original entry on oeis.org

0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 0, 1, 2, 0, 1, 2, 0, 1, 2, 9, 10, 11, 9, 10, 11, 9, 10, 11, 18, 19, 20, 18, 19, 20, 18, 19, 20, 81, 82
Offset: 0

Views

Author

Reinhard Zumkeller, Apr 11 2005

Keywords

Examples

			n = 123 = '11120' --> '10100' = 90 = a(123).
		

Crossrefs

Programs

  • Haskell
    a105186 0 = 0
    a105186 n = 9 * a105186 n' + mod t 3
                where (n', t) = divMod n 9
    -- Reinhard Zumkeller, Sep 26 2015
    
  • PARI
    a(n) = fromdigits(digits(n,9)%3,9); \\ Kevin Ryde, May 20 2020

Formula

a(n) = n - a(floor(n/3))*3, a(0) = 0.
a(n) = 9*a(floor(n/9)) + (n mod 9) mod 3. - Reinhard Zumkeller, Sep 26 2015