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.

This page as a plain text file.
%I A063005 #20 Apr 16 2023 16:09:31
%S A063005 0,1,1,5,7,5,37,47,13,269,295,1319,1909,1631,9823,13085,6487,72023,
%T A063005 84997,347141,517135,502829,2599981,3605639,2428309,19205525,24062143,
%U A063005 5077565,139295293,149450423,686321335,985222181,808182895,5103150191,6719515981,2978678759
%N A063005 Difference between 2^n and the next smaller or equal power of 3.
%C A063005 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
%H A063005 Alois P. Heinz, <a href="/A063005/b063005.txt">Table of n, a(n) for n = 0..3324</a>
%F A063005 a(n) = 2^n - 3^(floor (log_3 (2^n))).
%F A063005 a(n) = A000079(n) - 3^A136409(n). - _Michel Marcus_, Nov 19 2021
%p A063005 a:= n-> (t-> t-3^ilog[3](t))(2^n):
%p A063005 seq(a(n), n=0..40);  # _Alois P. Heinz_, Oct 11 2019
%t A063005 a[n_] := 2^n - 3^Floor[Log[3, 2] * n]; Array[a, 36, 0] (* _Amiram Eldar_, Nov 19 2021 *)
%o A063005 (PARI) for(n=0,50,print1(2^n-3^floor(log(2^n)/log(3))","))
%o A063005 (Python)
%o A063005 def a(n):
%o A063005     m, p, target = 0, 1, 2**n
%o A063005     while p <= target:  m += 1; p *= 3
%o A063005     return target - 3**(m-1)
%o A063005 print([a(n) for n in range(36)]) # _Michael S. Branicky_, Nov 19 2021
%Y A063005 Cf. A056577, A063003, A063004.
%Y A063005 Cf. A000079 (2^n), A000244 (3^n), A136409.
%K A063005 easy,nonn
%O A063005 0,4
%A A063005 _Jens Voß_, Jul 02 2001
%E A063005 More terms from _Ralf Stephan_, Mar 20 2003