login
A265747
Numbers written in Jacobsthal greedy base.
14
0, 1, 2, 10, 11, 100, 101, 102, 110, 111, 200, 1000, 1001, 1002, 1010, 1011, 1100, 1101, 1102, 1110, 1111, 10000, 10001, 10002, 10010, 10011, 10100, 10101, 10102, 10110, 10111, 10200, 11000, 11001, 11002, 11010, 11011, 11100, 11101, 11102, 11110, 11111, 20000, 100000, 100001, 100002, 100010, 100011, 100100
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.
Sequence A197911 gives the terms with no digit "2" in their representation, while its complement A003158 gives the terms where "2" occurs at least once.
Numbers beginning with digit "2" in this representation are given by A020988(n) [= 2*A002450(n) = 2*A001045(2n)].
LINKS
A. F. Horadam, Jacobsthal Representation Numbers, Fib Quart. 34 (1996), 40-54. (See especially page 50, which is page 11 in PDF.)
FORMULA
a(0) = 0; for n >= 1, a(n) = 10^(A130249(n)-2) + a(n-A001045(A130249(n))).
a(n) = A007089(A265746(n)).
EXAMPLE
For n=7, when selecting the terms of A001045 with the greedy algorithm, we need terms A001045(4) + A001045(2) + A001045(2) = 5 + 1 + 1, thus a(7) = "102".
For n=10, we need A001045(4) + A001045(4) = 5+5, thus a(10) = "200".
MATHEMATICA
jacob[n_] := (2^n - (-1)^n)/3; maxInd[n_] := Floor[Log2[3*n + 1]]; A265747[n_] := A265747[n] = 10^(maxInd[n] - 2) + A265747[n - jacob[maxInd[n]]]; A265747[0] = 0; Array[A265747, 100, 0] (* Amiram Eldar, Jul 21 2023 *)
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;
A265747(n) = {if(n==0, 0, my(d=n - A001045(A130249(n))); 10^(A130249(n)-2) + if(d == 0, 0, A265747(d))); } \\ Amiram Eldar, Jul 21 2023
CROSSREFS
Cf. A265745 (sum of digits).
Cf. A265746 (same numbers interpreted in base-3, then shown in decimal).
Cf. A084639 (positions of repunits).
Cf. A007961, A014417, A014418, A244159 for analogous sequences.
Sequence in context: A072545 A023151 A342535 * A104459 A008560 A188283
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 17 2015
STATUS
approved