This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A268289 a(0)=0; thereafter a(n) = a(n-1) - A037861(n). 5
 0, 1, 1, 3, 2, 3, 4, 7, 5, 5, 5, 7, 7, 9, 11, 15, 12, 11, 10, 11, 10, 11, 12, 15, 14, 15, 16, 19, 20, 23, 26, 31, 27, 25, 23, 23, 21, 21, 21, 23, 21, 21, 21, 23, 23, 25, 27, 31, 29, 29, 29, 31, 31, 33, 35, 39, 39, 41, 43, 47, 49 (list; graph; refs; listen; history; text; internal format)
 OFFSET 0,4 COMMENTS The graph of this sequence is a version of the Takagi curve: see Lagarias (2012), Section 9, especially Theorem 9.1. LINKS N. J. A. Sloane, Table of n, a(n) for n = 0..10000 Hsien-Kuei Hwang, S. Janson, 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, 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. Jeffrey C. Lagarias, The Takagi function and its properties, arXiv:1112.4205 [math.CA], 2011-2012. Jeffrey C. Lagarias, The Takagi function and its properties, In Functions in number theory and their probabilistic aspects, 153--189, RIMS Kôkyûroku Bessatsu, B34, Res. Inst. Math. Sci. (RIMS), Kyoto, 2012. MR3014845. FORMULA From N. J. A. Sloane, Mar 11 2016: (Start) a(0)=0; for n > 0, a(n) = a(n-1) + A000120(n) - A023416(n) = A000788(n) - A181132(n). a(0)=0; thereafter a(2n) = a(n) + a(n-1), a(2n+1) = 2a(n) + 1. G.f.: (1/(1-x)^2) * Sum_{k >= 0} x^(2^k)*(1-x^(2^k))/(1+x^(2^k)). a(2^k-1) = 2^k-1, a(3*2^k-1) = 2^(k+1)-1, a(5*2^k-1) = 3*2^k-1, etc. (End) MAPLE # Maple code from N. J. A. Sloane, Mar 07 2016 a000120 := proc(n) add(i, i=convert(n, base, 2)) end: a023416 := proc(n) if n = 0 then 1; else add(1-e, e=convert(n, base, 2)) ; end if; end proc: a268289:=proc(n) option remember; global a000120, a023416; if n=0 then 0 else a268289(n-1)+a000120(n)-a023416(n); fi; end; [seq(a268289(n), n=0..132)]; MATHEMATICA Join[{0}, Table[DigitCount[n, 2, 1] - DigitCount[n, 2, 0], {n, 1, 100}] // Accumulate] (* Jean-François Alcover, Oct 24 2016 *) PROG (Python) def sequence(x): x = str(bin(x)) y = [] for z in list(x):   if z == '0':    y.append(-1)   else:    y.append(1) y.pop(0) y.pop(0) return(y) #Use for sequence def pattern(upto): p = [] seed = 0 adds = [] while upto != 0:   adds.append(sequence(upto))   upto -= 1 while len(adds) != 0:   x = adds.pop()   for y in x:    seed += y   p.append(seed) return(p) #Use for numbers in / not in sequence def notin(upto, inn): x = pattern(int(upto) ** 2) y = [] while upto != 0:   if inn == False:    if upto not in x:     y.append(upto)   else:    if upto in x:     y.append(upto)   upto -= 1 y.reverse() return(y) (PARI) a(n) = if (n==0, 0, a(n-1) + 2* hammingweight(n) - #binary(n)); \\ Michel Marcus, Jan 31 2016 (PARI) lista(nn) = {a = 0; for (n=1, nn, a += 2* hammingweight(n) - #binary(n); print1(a, ", "); ); } CROSSREFS Cf. A000788, A181132, A037861, A023416, A000120, A269735. Sequence in context: A132408 A091821 A086035 * A201907 A003559 A200599 Adjacent sequences:  A268286 A268287 A268288 * A268290 A268291 A268292 KEYWORD nonn,base,hear,nice AUTHOR Mark Moore, Jan 30 2016 EXTENSIONS Simplified definition following a suggestion from Michel Marcus. Corrected start, added more terms. - N. J. A. Sloane, Mar 07 2016 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified August 21 13:31 EDT 2018. Contains 313954 sequences. (Running on oeis4.)