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.

A022560 a(0)=0, a(2*n) = 2*a(n) + 2*a(n-1) + n^2 + n, a(2*n+1) = 4*a(n) + (n+1)^2.

Original entry on oeis.org

0, 1, 4, 8, 16, 25, 36, 48, 68, 89, 112, 136, 164, 193, 224, 256, 304, 353, 404, 456, 512, 569, 628, 688, 756, 825, 896, 968, 1044, 1121, 1200, 1280, 1392, 1505, 1620, 1736, 1856, 1977, 2100, 2224, 2356, 2489, 2624, 2760, 2900, 3041
Offset: 0

Views

Author

Andre Kundgen (kundgen(AT)math.uiuc.edu)

Keywords

Crossrefs

First differences are in A006520.
Cf. A070263.

Programs

  • Mathematica
    a[n_]:= If[n==0, 0, If[Mod[n, 2]==0, 2*a[n/2] + 2*a[n/2-1] +(n/2)^2 +(n/2), 4*a[(n-1)/2] +((n+1)/2)^2]]; Table[a[n], {n, 0, 50}] (* G. C. Greubel, Feb 26 2018 *)
  • PARI
    a(n) = if (n==0, 0, if (n % 2, my(nn = (n-1)/2); 4*a(nn)+(nn+1)^2, my(nn = n/2); 2*a(nn)+2*a(nn-1)+nn^2+nn)) \\ Michel Marcus, Jun 27 2013
    
  • Sage
    def a(n):
        if (n==0): return 0
        elif (n%2==0): return 2*a(n/2) + 2*a(n/2 -1) +(n/2)^2 +(n/2)
        else: return 4*a((n-1)/2) +((n+1)/2)^2
    [a(n) for n in (0..50)] # G. C. Greubel, Jun 13 2019

Formula

Let a(i, n) = 2^(i-1)*floor(1/2 + n/2^i); sequence is a(n) = Sum_{i=1} a(i, n)*(n - a(i, n)).
Second differences give A006519.
Also a(1)=0 and a(n) = floor(n^2/4) + a(floor(n/2)) + a(ceiling(n/2)).
G.f.: 1/(1-x)^2 * (x/(1-x) + Sum_{k>=1} 2^(k-1)*x^2^k/(1-x^2^k)). - Ralf Stephan, Apr 17 2003
a(0)=0, a(2n) = 2*a(n) + 2*a(n-1) + n^2 + n, a(2n+1) = 4a(n)+(n+1)^2. - Ralf Stephan, Sep 13 2003

Extensions

More terms from Ralf Stephan, Sep 13 2003