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.

A054414 a(n) = 1 + floor(n/(1-log(2)/log(3))).

Original entry on oeis.org

1, 3, 6, 9, 11, 14, 17, 19, 22, 25, 28, 30, 33, 36, 38, 41, 44, 47, 49, 52, 55, 57, 60, 63, 66, 68, 71, 74, 76, 79, 82, 84, 87, 90, 93, 95, 98, 101, 103, 106, 109, 112, 114, 117, 120, 122, 125, 128, 131, 133, 136, 139, 141, 144, 147, 150, 152, 155, 158, 160, 163
Offset: 0

Views

Author

B. Schaaf (m.m.schaaf-visch(AT)wxs.nl), May 20 2000

Keywords

Comments

These numbers appear in connection with the 3x+1 problem.
Also, numbers n such that the first digit in ternary expansion on 2^n is 2. N. J. A. Sloane conjectured that, for any integer n >=15, 2^n always has a 0 in its ternary expansion. - Mohammed Bouayoun (Mohammed.bouayoun(AT)sanef.com), Apr 24 2006
Except for 1, this is the complement of A020914 and therefore these two form a pair of Beatty sequences. - Robert G. Wilson v, May 25 2014

Examples

			a(5) = 1 + floor(5/(1-log(2)/log(3)))= 1 + floor(5/0.3690702464...)= 1 + floor(13.54...) = 14.
		

Crossrefs

Cf. A020914.

Programs

  • Maple
    Digits := 500: it := evalf(ln(2)/ln(3)): for n from 0 to 200 do printf(`%d,`,1+floor(n/(1-it))) od:
  • Mathematica
    Do[If[First[IntegerDigits[2^n, 3]] == 2, Print[n]], {n, 1, 200}] (* Mohammed Bouayoun (Mohammed.bouayoun(AT)sanef.com), Apr 24 2006 *)
    f[n_]:=Floor[1+n/(1-(Log[2]/Log[3]))];Array[f,105] (* Robert G. Wilson v, May 25 2014 *)
  • PARI
    alist(N) = my(a=1/2, b=1, r=-1); vector(N, i, a*=4; b*=3; r+=2; if(a>b, a*=2; b*=3; r++); r); \\ Ruud H.G. van Tol, Jan 21 2024 (with help from the pari-users mailing list)
    
  • Python
    from operator import sub
    from sympy import integer_log
    def A054414(n):
        if n == 0: return 1
        def f(x): return n+sub(*integer_log(1<Chai Wah Wu, Oct 09 2024
    
  • Python
    # faster for initial segment of sequence
    from itertools import islice
    def agen(): # generator of terms, after Ruud H.G. van Tol
        a, b, r = 2, 3, 1
        while True:
            yield r
            a <<= 2; b *= 3; r += 2
            if a > b: a <<= 1; b *= 3; r += 1
    print(list(islice(agen(), 100))) # Michael S. Branicky, Oct 10 2024

Formula

a(n) = 1 + floor(n * r), with r = log(3) / log(3/2) = 2.709511... - Ruud H.G. van Tol, May 09 2024

Extensions

More terms from James Sellers, May 23 2000
Erroneous formula a(n) =? A083088(n) + n - 1 deleted Jan 30 2008