OFFSET
0,6
COMMENTS
k-th segment has length 2^k (k>=0).
LINKS
Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, Exact and asymptotic solutions of the recurrence f(n) = f(floor(n/2)) + f(ceiling(n/2)) + g(n): theory and applications, Preprint, 2016.
Hsien-Kuei Hwang, S. Janson, and T.-H. Tsai, Exact and Asymptotic Solutions of a Divide-and-Conquer Recurrence Dividing at Half: Theory and Applications, ACM Transactions on Algorithms, 13:4 (2017), #47; DOI: 10.1145/3127585.
Ralf Stephan, Some divide-and-conquer sequences ...
Ralf Stephan, Table of generating functions
FORMULA
G.f.: -1 + 2/(1-x) + 1/(1-x)^2 * (-1 + sum(k>=0, 2t^2(t-1), t=x^2^k)). a(n) = A005942(n+2) - 3(n+1), n>0. - Ralf Stephan, Sep 13 2003
a(0)=0, a(2n) = a(n) + a(n-1) + (n==1), a(2n+1) = 2a(n). - Ralf Stephan, Oct 20 2003
a(n) = A053646(n+1). - M. F. Hasler, Oct 27 2025
PROG
(PARI) apply( {A080776(n, e=exponent(n++))=min(n-2^e, 2<<e-n)}, [0..99]) \\ M. F. Hasler, Oct 27 2025
(Python)
def A080776(n): return min(n+1-(m:=1<<(n+1).bit_length()-1), (m<<1)-n-1) # Chai Wah Wu, Oct 31 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
N. J. A. Sloane, Mar 11 2003
STATUS
approved
