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.

Showing 1-3 of 3 results.

A049971 a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 4, where m = 2*n - 2 - 2^(p+1) and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = 1, a(2) = 3, and a(3) = 2.

Original entry on oeis.org

1, 3, 2, 9, 24, 42, 90, 213, 597, 984, 1974, 3981, 8133, 17037, 37071, 87198, 244557, 401919, 803844, 1607721, 3215613, 6431997, 12866991, 25747038, 51564237, 103443195, 208092192, 421008660, 861332361, 1800360879, 3918287223, 9215926665, 25847419116, 42478911570, 84957823146
Offset: 1

Views

Author

Keywords

Examples

			a(5) = a(1) + a(2) + a(3) + a(4) + a(m) = 1 + 3 + 2 + 9 + a(m) = 15 + a(m). where m = 2*n - 2 - 2^(p+1) and 2^p < n - 1 = 4 <= 2^(p+1). We have p = 1 giving m = 2*5 - 2 - 4 = 4. As a(m) = a(4) = 9, we have a(5) = 15 + 9 = 24. - _David A. Corneth_, Apr 26 2020
		

Crossrefs

Cf. A049922 (similar, but with minus a(m/2)), A049923 (similar, but with minus a(m)), A049970 (similar, but with plus a(m/2)).

Programs

  • Maple
    s := proc(n) option remember; `if`(n < 1, 0, a(n) + s(n - 1)) end proc:
    a := proc(n) option remember;
    `if`(n < 4, [1, 3, 2][n], s(n - 1) + a(-2^ceil(log[2](n - 1)) + 2*n - 2)):
    end proc:
    seq(a(n), n = 1..40); # Petros Hadjicostas, Apr 25 2020
    # Alternative, uses A062050:
    a := proc(n) option remember; if n < 4 then [1, 3, 2][n] else
    add(a(i), i = 1..n-1 ) + a(2*A062050(n-2)) fi end:
    seq(a(n), n = 1..35); # Peter Luschny, Aug 06 2021
  • Mathematica
    a[1] = 1; a[2] = 3; a[3] = 2; a[n_] := a[n] = Sum[a[k], {k, 1, n - 1}] + a[2*n - 2 - 2^Floor[1 + Log[2, n - 2]]]; Table[a[n], {n, 1, 30}] (* Vaclav Kotesovec, Apr 26 2020 *)
  • PARI
    lista(nn) = { my(va = vector(nn)); va[1] = 1; va[2] = 3; va[3] = 2; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa + va[2*n - 2 - 2*2^logint(n-2, 2)]; sa += va[n]; ); va; } \\ Michel Marcus, Apr 26 2020 (with nn > 2)
    
  • PARI
    first(n) = {n = max(n, 3); my(res = vector(n), s = 6, p = 1); res[1]  = 1; res[2] = 3; res[3] = 2; for(i = 4, n, if(i - 1 > 1 << (p + 1), p++); res[i] = s + res[2*i-2-2^(p+1)]; s += res[i]) ; res} \\ David A. Corneth, Apr 26 2020

Extensions

Name edited by Petros Hadjicostas, Apr 25 2020
More terms from David A. Corneth, Apr 26 2020

A049922 a(n) = a(1) + a(2) + ... + a(n-1) - a(m) for n >= 4, where m = n - 1 - 2^p and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = 1, a(2) = 3 and a(3) = 2.

Original entry on oeis.org

1, 3, 2, 5, 8, 18, 34, 69, 135, 274, 546, 1093, 2183, 4363, 8716, 17416, 34797, 69662, 139322, 278645, 557287, 1114571, 2229132, 4458248, 8916461, 17832856, 35665573, 71330874, 142661201, 285321312, 570640444, 1141276535, 2282544370
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A049923 (similar, but with minus a(2*m)), A049970 (similar, but with plus a(m)), A049971 (similar, but with plus a(2*m)).

Programs

  • PARI
    lista(nn) = { my(va = vector(nn)); va[1] = 1; va[2] = 3; va[3] = 2; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa - va[n - 1 - 2^ceil(-1 + log(n-1)/log(2))]; sa += va[n]; ); va; } \\ Petros Hadjicostas, Apr 26 2020 (with nn > 2)

Extensions

Name edited by Petros Hadjicostas, Apr 26 2020

A049970 a(n) = a(1) + a(2) + ... + a(n-1) + a(m) for n >= 4, where m = n - 1 - 2^p and p is the unique integer such that 2^p < n - 1 <= 2^(p+1), starting with a(1) = 1, a(2) = 3, and a(3) = 2.

Original entry on oeis.org

1, 3, 2, 7, 16, 30, 62, 123, 251, 496, 994, 1987, 3979, 7967, 15948, 31928, 63917, 127712, 255426, 510851, 1021707, 2043423, 4086860, 8173752, 16347565, 32695258, 65390761, 130782020, 261565033, 523132058, 1046268104, 2092544189
Offset: 1

Views

Author

Keywords

Crossrefs

Cf. A049922 (similar, but with minus a(m)), A049923 (similar, but with minus a(2*m)), A049971 (similar, but with plus a(2*m)).

Programs

  • Mathematica
    a[1] = 1; a[2] = 3; a[3] = 2; a[n_] := a[n] = Sum[a[k], {k, 1, n - 1}] + a[n - 1 - 2^Floor[Log[2, n - 2]]]; Table[a[n], {n, 1, 32}] (* Vaclav Kotesovec, Apr 26 2020 *)
  • PARI
    lista(nn) = { my(va = vector(nn)); va[1] = 1; va[2] = 3; va[3] = 2; my(sa = vecsum(va)); for (n=4, nn, va[n] = sa + va[n - 1 - 2^ceil(-1 + log(n-1)/log(2))]; sa += va[n]; ); va; } \\ Petros Hadjicostas, Apr 26 2020 (with nn > 2)

Formula

a(n) ~ c * 2^n, where c = 0.487208413167251561410300158795277398357249626073353318217181284278722123325... - Vaclav Kotesovec, Apr 26 2020

Extensions

Name edited by Petros Hadjicostas, Apr 25 2020
Showing 1-3 of 3 results.