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.

Showing 1-6 of 6 results.

A020915 Number of digits in base-3 representation of 2^n.

Original entry on oeis.org

1, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 47
Offset: 0

Views

Author

Keywords

Comments

For n > 0, first differences of A022331. - Michel Marcus, Oct 03 2013

Crossrefs

Cf. A022924 (first differences).

Programs

Formula

a(n) = 1 + floor(n*log_3(2)) = 1 + floor(n*A102525) = 1 + A136409(n). - R. J. Mathar, May 23 2009
a(n) = A081604(A000079(n)). - Reinhard Zumkeller, Jul 12 2011
a(A020914(n)) = n + 1. - Reinhard Zumkeller, Mar 28 2015

Extensions

More terms from James Sellers

A063005 Difference between 2^n and the next smaller or equal power of 3.

Original entry on oeis.org

0, 1, 1, 5, 7, 5, 37, 47, 13, 269, 295, 1319, 1909, 1631, 9823, 13085, 6487, 72023, 84997, 347141, 517135, 502829, 2599981, 3605639, 2428309, 19205525, 24062143, 5077565, 139295293, 149450423, 686321335, 985222181, 808182895, 5103150191, 6719515981, 2978678759
Offset: 0

Views

Author

Jens Voß, Jul 02 2001

Keywords

Comments

Sequence generalized : a(n) = A^n - B^(floor(log_B (A^n))) where A, B are integers. This sequence has A = 2, B = 3; A056577 has A = 3, B = 2. - Ctibor O. Zizka, Mar 03 2008

Crossrefs

Cf. A000079 (2^n), A000244 (3^n), A136409.

Programs

  • Maple
    a:= n-> (t-> t-3^ilog[3](t))(2^n):
    seq(a(n), n=0..40);  # Alois P. Heinz, Oct 11 2019
  • Mathematica
    a[n_] := 2^n - 3^Floor[Log[3, 2] * n]; Array[a, 36, 0] (* Amiram Eldar, Nov 19 2021 *)
  • PARI
    for(n=0,50,print1(2^n-3^floor(log(2^n)/log(3))","))
    
  • Python
    def a(n):
        m, p, target = 0, 1, 2**n
        while p <= target:  m += 1; p *= 3
        return target - 3**(m-1)
    print([a(n) for n in range(36)]) # Michael S. Branicky, Nov 19 2021

Formula

a(n) = 2^n - 3^(floor (log_3 (2^n))).
a(n) = A000079(n) - 3^A136409(n). - Michel Marcus, Nov 19 2021

Extensions

More terms from Ralf Stephan, Mar 20 2003

A156301 a(n) = ceiling( n * log_3(2) ) = ceiling(n * 0.6309297535714574371...).

Original entry on oeis.org

0, 1, 2, 2, 3, 4, 4, 5, 6, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12, 12, 13, 14, 14, 15, 16, 16, 17, 18, 18, 19, 19, 20, 21, 21, 22, 23, 23, 24, 24, 25, 26, 26, 27, 28, 28, 29, 30, 30, 31, 31, 32, 33, 33, 34, 35, 35, 36, 36, 37, 38, 38, 39, 40, 40, 41, 42, 42, 43, 43, 44, 45, 45, 46, 47
Offset: 0

Views

Author

Jonathan Vos Post, Feb 07 2009

Keywords

Comments

a(n) is the unique k such that 1/2 <= 3^a(n)/2^(n+1) < 3/2. Equality occurs iff n = 0. See Gorman-Huang and Marks.

Crossrefs

Cf. A020915, A102525. - R. J. Mathar, Feb 19 2009
Cf. A136409.

Programs

  • Haskell
    a156301 = ceiling . (* logBase 3 2) . fromIntegral
    -- Reinhard Zumkeller, Jul 03 2015
    
  • Maple
    seq(ceil(n*log[3](2)),n=0..120) ; # R. J. Mathar, Mar 14 2009
  • Mathematica
    With[{c=Log[3,2]},Ceiling[c*Range[0,80]]] (* Harvey P. Dale, Aug 07 2015 *)
  • Python
    from operator import sub
    from sympy import integer_log
    def A156301(n): return sub(*integer_log(1<Chai Wah Wu, Oct 09 2024

Extensions

More terms from R. J. Mathar, Mar 14 2009
Edited by N. J. A. Sloane, May 23 2009 at the suggestion of Hagen von Eitzen

A265210 Irregular triangle read by rows in which row n lists the base 3 digits of 2^n in reverse order, n >= 0.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 1, 0, 1, 1, 0, 1, 2, 2, 0, 2, 1, 1, 1, 1, 1, 0, 0, 1, 2, 2, 2, 0, 0, 2, 1, 2, 2, 1, 0, 1, 1, 2, 1, 2, 0, 1, 2, 2, 1, 0, 2, 1, 2, 1, 2, 1, 2, 0, 1, 0, 2, 0, 2, 0, 1, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 1
Offset: 0

Views

Author

L. Edson Jeffery, Dec 04 2015

Keywords

Comments

The length of row n is A020915(n) = 1 + A136409(n).
Conjecture 1: The sequence in column k is periodic, with period p(k) = 2*3^(k-1) = A008776(k-1), k >= 1, and in which the numbers 0,1,2 appear with equal frequency, for each k>1.

Examples

			n
0:    1
1:    2
2:    1  1
3:    2  2
4:    1  2  1
5:    2  1  0  1
6:    1  0  1  2
7:    2  0  2  1  1
8:    1  1  1  0  0  1
9:    2  2  2  0  0  2
10:   1  2  2  1  0  1  1
11:   2  1  2  0  1  2  2
12:   1  0  2  1  2  1  2  1
13:   2  0  1  0  2  0  2  0  1
14:   1  1  2  0  1  1  1  1  2
15:   2  2  1  1  2  2  2  2  1  1
		

Crossrefs

Cf. A000079 (powers of 2), A004642 (powers of 2 written in base 3), A008776 (2*3^n).
Cf. A265209 (base 3 digits of 2^n).
Cf. A264980 (row n read as ternary number).
Cf. A037096 (numbers constructed from the inverse case, base 2 digits of 3^n).

Programs

  • Mathematica
    (* Replace Flatten with Grid to display the triangle: *)
    Flatten[Table[Reverse[IntegerDigits[2^n, 3]], {n, 0, 15}]]
  • PARI
    A265210_row(n)=Vecrev(digits(2^n,3)) \\ M. F. Hasler, Dec 05 2015

A022924 Number of 3^m between 2^n and 2^(n+1).

Original entry on oeis.org

0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1
Offset: 0

Views

Author

Keywords

Comments

This is a Sturmian sequence; consider the straight line of equation y = x*log(3)/log(2), the sequence gives the number m of integer ordinate points between the abscissa points n and n+1. - Richard Aime Blavy, Jun 14 2020

Crossrefs

Cf. A136409 (partial sums).
First differences of A020915.

Programs

A265209 Irregular triangle read by rows in which row n lists the base-3 digits of 2^n, n >= 0.

Original entry on oeis.org

1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 0, 1, 2, 2, 1, 0, 1, 1, 1, 2, 0, 2, 1, 0, 0, 1, 1, 1, 2, 0, 0, 2, 2, 2, 1, 1, 0, 1, 2, 2, 1, 2, 2, 1, 0, 2, 1, 2, 1, 2, 1, 2, 1, 2, 0, 1, 1, 0, 2, 0, 2, 0, 1, 0, 2, 2, 1, 1, 1, 1, 0, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 2, 2
Offset: 0

Views

Author

L. Edson Jeffery, Dec 04 2015

Keywords

Comments

The length of row n is A020915(n) = 1 + A136409(n).

Examples

			Triangle begins:
  1
  2
  1  1
  2  2
  1  2  1
  1  0  1  2
  2  1  0  1
  1  1  2  0  2
  1  0  0  1  1  1
  2  0  0  2  2  2
  1  1  0  1  2  2  1
  2  2  1  0  2  1  2
  1  2  1  2  1  2  0  1
  1  0  2  0  2  0  1  0  2
  2  1  1  1  1  0  2  1  1
  1  1  2  2  2  2  1  1  2  2
		

Crossrefs

Cf. A000079 (powers of 2), A003137, A004642 (powers of 2 written in base 3).
Cf. A265210 (base 3 digits of 2^n in reverse order).

Programs

  • Mathematica
    (* Replace Flatten with Grid to display the triangle: *)
    Flatten[Table[IntegerDigits[2^n, 3], {n, 0, 15}]]
  • PARI
    for(n=0,15,for(k=1,#digits(2^n,3),print1(digits(2^n,3)[k],", "))) \\ Derek Orr, Dec 24 2015
Showing 1-6 of 6 results.