OFFSET
0,3
COMMENTS
These are called "Jacobsthal Representation Numbers" in Horadam's 1996 paper.
Sum_{i=0..} digit(i)*A001045(2+digit(i)) recovers n from such representation a(n), where digit(0) stands for the least significant digit (at the right), and A001045(k) gives the k-th Jacobsthal number.
No larger digits than 2 will occur, which allows representing the same sequence in a more compact form by base-3 coding in A265746.
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..10923
A. F. Horadam, Jacobsthal Representation Numbers, Fib Quart. 34 (1996), 40-54. (See especially page 50, which is page 11 in PDF.)
FORMULA
EXAMPLE
MATHEMATICA
PROG
(Scheme, with memoization-macro definec)
(definec (A265747 n) (if (zero? n) n (+ (expt 10 (- (A130249 n) 2)) (A265747 (- n (A001045 (A130249 n)))))))
(Python)
def greedyJ(n): m = (3*n+1).bit_length() - 1; return (m, (2**m-(-1)**m)//3)
def a(n):
if n == 0: return 0
place, value = greedyJ(n)
return 10**(place-2) + a(n - value)
print([a(n) for n in range(49)]) # Michael S. Branicky, Jul 11 2021
(PARI)
A130249(n) = floor(log(3*n + 1) / log(2));
A001045(n) = (2^n - (-1)^n) / 3;
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 17 2015
STATUS
approved