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.

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