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-3 of 3 results.

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

A056850 Minimal absolute difference of 3^n and 2^k.

Original entry on oeis.org

0, 1, 1, 5, 17, 13, 217, 139, 1631, 3299, 6487, 46075, 7153, 502829, 588665, 2428309, 9492289, 5077565, 118985033, 88519643, 808182895, 1870418611, 2978678759, 25423702091, 7551629537, 252223018333, 342842572777, 1170495537221, 5284606410545, 1738366812781
Offset: 0

Views

Author

Robert G. Wilson v, Aug 30 2000

Keywords

Comments

Except for 3^0 - 2^0, 3^1 - 2^1 and 3^2 - 2^3, there are no cases where the differences are less than 4.
It is known that a(n) tends to infinity as n tends to infinity. Indeed, Tijdeman showed that there exists an effectively computable constant c > 0 such that |2^x - 3^y| > 2^x/x^c. - Tomohiro Yamada, Sep 29 2017
Empirical observation: For at least values a(0) through a(6308), k-2 < n*log_2(3) < k+2. - Matthew Schuster, Mar 28 2021
For all n >= 0, the lower and upper limits on n*log_2(3) - k are log_2(3/4) = -0.4150374... and log_2(3/2) = 0.5849625..., respectively; i.e., 0 <= n*log_2(3) - k - log_2(3/4) < 1. - Jon E. Schoenfield, Apr 21 2021

Examples

			For n = 4, the closest power of 2 to 3^n = 81 is 2^6 = 64, so a(4) = |3^4 - 2^6| = |81 - 64| = 17. - _Jon E. Schoenfield_, Sep 30 2017
		

Crossrefs

Cf. A056577 (smallest 3^n-2^k), A063003 (smallest 2^k-3^n).

Programs

  • Mathematica
    Table[Min[# - 2^Floor@ Log2@ # &[3^n], 2^Ceiling@ Log2@ # - # &[3^n]], {n, 0, 27}]

Extensions

a(28)-a(29) from Jon E. Schoenfield, Mar 31 2021

A063004 Difference between 2^n and the next larger or equal power of 3.

Original entry on oeis.org

0, 1, 5, 1, 11, 49, 17, 115, 473, 217, 1163, 139, 2465, 11491, 3299, 26281, 111611, 46075, 269297, 7153, 545747, 2685817, 588665, 5960299, 26269505, 9492289, 62031299, 253202761, 118985033, 625390555, 88519643, 1339300753
Offset: 0

Views

Author

Jens Voß, Jul 02 2001

Keywords

Crossrefs

Programs

  • Mathematica
    dp23[n_]:=Module[{t=2^n},3^Ceiling[Log[3,t]]-t]; Array[dp23,40,0] (* Harvey P. Dale, Nov 20 2015 *)
  • PARI
    for(n=1,50,print1(3^ceil(log(2^n)/log(3))-2^n","))

Formula

a(n) = 3^ceiling(log_3(2^n)) - 2^n.

Extensions

More terms from Ralf Stephan, Mar 21 2003
Showing 1-3 of 3 results.