cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A174868 Partial sums of Stern's diatomic series A002487.

Original entry on oeis.org

0, 1, 2, 4, 5, 8, 10, 13, 14, 18, 21, 26, 28, 33, 36, 40, 41, 46, 50, 57, 60, 68, 73, 80, 82, 89, 94, 102, 105, 112, 116, 121, 122, 128, 133, 142, 146, 157, 164, 174, 177, 188, 196, 209, 214, 226, 233, 242, 244, 253, 260, 272, 277, 290, 298, 309, 312, 322, 329, 340, 344, 353, 358, 364, 365, 372, 378, 389, 394, 408, 417, 430, 434, 449, 460, 478, 485, 502, 512, 525, 528, 542, 553, 572, 580, 601, 614, 632, 637, 654, 666, 685
Offset: 0

Views

Author

Jonathan Vos Post, Dec 01 2010

Keywords

Comments

After the initial 0, identical to A007729.

Examples

			a(16) = 0 + 1 + 1 + 2 + 1 + 3 + 2 + 3 + 1 + 4 + 3 + 5 + 2 + 5 + 3 + 4 + 1 = 41.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := a[n] = If[EvenQ[n], 2*a[n/2] + a[n/2 - 1], 2*a[(n - 1)/2] + a[(n + 1)/2]]; a[0] = 0; a[1] = 1; Array[a, 100, 0] (* Amiram Eldar, May 18 2023 *)
  • Python
    from itertools import accumulate, count, islice
    from functools import reduce
    def A174868_gen(): # generator of terms
        return accumulate((sum(reduce(lambda x,y:(x[0],x[0]+x[1]) if int(y) else (x[0]+x[1],x[1]),bin(n)[-1:2:-1],(1,0))) for n in count(1)),initial=0)
    A174868_list = list(islice(A174868_gen(),30)) # Chai Wah Wu, May 07 2023

Formula

a(n) = Sum_{i=0..n} A002487(i).
G.f.: (x/(1 - x))*Product_{k>=0} (1 + x^(2^k) + x^(2^(k+1))). - Ilya Gutkovskiy, Feb 27 2017
a(2k) = 2*a(k) + a(k-1); a(2k+1) = 2*a(k) + a(k+1). - Michael J. Collins, Dec 25 2018
a(n) = n^log_2(3) + Psi_D(log_2(n)) + O(n^log_2(phi)), where phi is the golden ratio (A001622) and Psi_D is a 1-periodic continuous function which is Hölder continuous with any exponent smaller than log_2(3/phi) (Heuberger et al., 2022). - Amiram Eldar, May 18 2023