OFFSET
0,3
COMMENTS
Sum of digits in "Jacobsthal greedy base", A265747.
It would be nice to know for sure whether this sequence gives also the least number of Jacobsthal numbers that add to n, i.e., that there cannot be even better nongreedy solutions.
The integer 63=21+21+21 has 3 for its 'non-greedy' solution, and a(63) = 5 for its greedy solution 63=43+11+5+3+1. - Yuriko Suwa, Jul 11 2021
Positions where a(n) is different from A372555(n) are n=63, 84, 148, 169, 191, 212, 234, 255, etc. See A372557. - Antti Karttunen, May 07 2024
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..10923
FORMULA
EXAMPLE
a(0) = 0, because no numbers are needed to form an empty sum, which is zero.
For n=1 we need just A001045(2) = 1, thus a(1) = 1.
MATHEMATICA
PROG
(Scheme, with memoization-macro definec)
(Python)
def greedyJ(n): n1 = (3*n+1).bit_length() - 1; return (2**n1 - (-1)**n1)//3
def a(n): return 0 if n == 0 else 1 + a(n - greedyJ(n))
print([a(n) for n in range(107)]) # Michael S. Branicky, Jul 11 2021
(PARI)
A130249(n) = floor(log(3*n + 1)/log(2));
A001045(n) = (2^n - (-1)^n) / 3;
A265745(n) = {if(n == 0, 0, my(d = n - A001045(A130249(n))); if(d == 0, 1, 1 + A265745(d))); } \\ Amiram Eldar, Jul 21 2023
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Dec 17 2015
STATUS
approved