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))).

This page as a plain text file.
%I A054414 #55 Jul 02 2025 16:01:59
%S A054414 1,3,6,9,11,14,17,19,22,25,28,30,33,36,38,41,44,47,49,52,55,57,60,63,
%T A054414 66,68,71,74,76,79,82,84,87,90,93,95,98,101,103,106,109,112,114,117,
%U A054414 120,122,125,128,131,133,136,139,141,144,147,150,152,155,158,160,163
%N A054414 a(n) = 1 + floor(n/(1-log(2)/log(3))).
%C A054414 These numbers appear in connection with the 3x+1 problem.
%C A054414 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
%C A054414 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
%F A054414 a(n) = 1 + floor(n * r), with r = log(3) / log(3/2) = 2.709511... - _Ruud H.G. van Tol_, May 09 2024
%e A054414 a(5) = 1 + floor(5/(1-log(2)/log(3)))= 1 + floor(5/0.3690702464...)= 1 + floor(13.54...) = 14.
%p A054414 Digits := 500: it := evalf(ln(2)/ln(3)): for n from 0 to 200 do printf(`%d,`,1+floor(n/(1-it))) od:
%t A054414 Do[If[First[IntegerDigits[2^n, 3]] == 2, Print[n]], {n, 1, 200}] (* Mohammed Bouayoun (Mohammed.bouayoun(AT)sanef.com), Apr 24 2006 *)
%t A054414 f[n_]:=Floor[1+n/(1-(Log[2]/Log[3]))];Array[f,105] (* _Robert G. Wilson v_, May 25 2014 *)
%o A054414 (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)
%o A054414 (Python)
%o A054414 from operator import sub
%o A054414 from sympy import integer_log
%o A054414 def A054414(n):
%o A054414     if n == 0: return 1
%o A054414     def f(x): return n+sub(*integer_log(1<<x,3))+1
%o A054414     m, k = n, f(n)
%o A054414     while m != k: m, k = k, f(k)
%o A054414     return m # _Chai Wah Wu_, Oct 09 2024
%o A054414 (Python) # faster for initial segment of sequence
%o A054414 from itertools import islice
%o A054414 def agen(): # generator of terms, after _Ruud H.G. van Tol_
%o A054414     a, b, r = 2, 3, 1
%o A054414     while True:
%o A054414         yield r
%o A054414         a <<= 2; b *= 3; r += 2
%o A054414         if a > b: a <<= 1; b *= 3; r += 1
%o A054414 print(list(islice(agen(), 100))) # _Michael S. Branicky_, Oct 10 2024
%Y A054414 Cf. A020914.
%K A054414 easy,nonn
%O A054414 0,2
%A A054414 B. Schaaf (m.m.schaaf-visch(AT)wxs.nl), May 20 2000
%E A054414 More terms from _James Sellers_, May 23 2000
%E A054414 Erroneous formula a(n) =? A083088(n) + n - 1 deleted Jan 30 2008