login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

A054414
a(n) = 1 + floor(n/(1-log(2)/log(3))).
10
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,2
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
FORMULA
a(n) = 1 + floor(n * r), with r = log(3) / log(3/2) = 2.709511... - Ruud H.G. van Tol, May 09 2024
EXAMPLE
a(5) = 1 + floor(5/(1-log(2)/log(3)))= 1 + floor(5/0.3690702464...)= 1 + floor(13.54...) = 14.
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 *)
PROG
(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<<x, 3))+1
m, k = n, f(n)
while m != k: m, k = k, f(k)
return m # 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
CROSSREFS
Cf. A020914.
Sequence in context: A094740 A305849 A047400 * A136616 A121384 A310146
KEYWORD
easy,nonn
AUTHOR
B. Schaaf (m.m.schaaf-visch(AT)wxs.nl), May 20 2000
EXTENSIONS
More terms from James A. Sellers, May 23 2000
Erroneous formula a(n) =? A083088(n) + n - 1 deleted Jan 30 2008
STATUS
approved