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.

A132141 Numbers whose ternary representation begins with 1.

Original entry on oeis.org

1, 3, 4, 5, 9, 10, 11, 12, 13, 14, 15, 16, 17, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 20 2007

Keywords

Comments

The lower and upper asymptotic densities of this sequence are 1/2 and 3/4, respectively. - Amiram Eldar, Feb 28 2021

Crossrefs

Programs

  • Haskell
    a132141 n = a132141_list !! (n-1)
    a132141_list = filter ((== 1) . until (< 3) (flip div 3)) [1..]
    -- Reinhard Zumkeller, Feb 06 2015
  • Mathematica
    Flatten[(Range[3^#,2 3^#-1])&/@Range[0,4]] (* Zak Seidov, Mar 03 2009 *)
  • PARI
    s=[];for(n=0,4,for(x=3^n,2*3^n-1,s=concat(s,x)));s \\ Zak Seidov, Mar 03 2009
    
  • PARI
    a(n) = n + 3^logint(n<<1,3) >> 1; \\ Kevin Ryde, Feb 19 2022
    

Formula

A number n is a term iff 3^m <= n < 2*3^m -1, for m=0,1,2,... - Zak Seidov, Mar 03 2009
a(n) = n + (3^floor(log_3(2*n)) - 1)/2. - Kevin Ryde, Feb 19 2022