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.

A157671 Numbers whose ternary representation begins with 2.

Original entry on oeis.org

2, 6, 7, 8, 18, 19, 20, 21, 22, 23, 24, 25, 26, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184
Offset: 1

Views

Author

Zak Seidov, Mar 04 2009

Keywords

Comments

From R. J. Mathar, Mar 03 2009: (Start)
If we look at the sequence first differences, i.e.,
2, 4, 1, 1, 10, 1, 1, 1, 1, 1, 1, 1, 1, 28, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 82, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, we obtain the records in A034472. (End)
The lower and upper asymptotic densities of this sequence are 1/4 and 1/2, respectively. - Amiram Eldar, Feb 28 2021

Crossrefs

Subsequence of A134026. - Reinhard Zumkeller, Jan 20 2010

Programs

  • Haskell
    a157671 n = a157671_list !! (n-1)
    a157671_list = filter ((== 2) . until (< 3) (flip div 3)) [1..]
    -- Reinhard Zumkeller, Feb 06 2015
  • Maple
    for n from 1 to 300 do dgs := convert(n,base,3) ; if op(-1,dgs) = 2 then printf("%d,",n) ; fi; od: # R. J. Mathar, Mar 03 2009
  • Mathematica
    Flatten[(Range[2*3^#,3^(#+1)-1])&/@Range[0,4]]
    Select[Range[200],First[IntegerDigits[#,3]]==2&] (* Harvey P. Dale, Oct 16 2012 *)
    Table[FromDigits[#,3]&/@(Join[{2},#]&/@Tuples[{0,1,2},n]),{n,0,4}]// Flatten (* Harvey P. Dale, Jan 28 2022 *)
  • PARI
    s=[];for(n=0,4,for(x=3^n,2*3^n-1,s=concat(s,x)));s
    

Formula

A number k is a term if and only if 2*3^m <= k <= 3^(m+1)-1, for m=0,1,2,...
A171960(a(n)) < a(n). - Reinhard Zumkeller, Jan 20 2010