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.

Previous Showing 11-12 of 12 results.

A214255 Number of compositions of n where differences between neighboring parts are in {-2,...,2}.

Original entry on oeis.org

1, 1, 2, 4, 8, 14, 27, 49, 92, 170, 317, 587, 1097, 2038, 3798, 7072, 13176, 24538, 45720, 85166, 158670, 295596, 550708, 1025974, 1911445, 3561079, 6634457, 12360279, 23027789, 42901825, 79928175, 148909982, 277426505, 516858952, 962933307, 1793991419
Offset: 0

Views

Author

Alois P. Heinz, Jul 08 2012

Keywords

Examples

			a(3) = 4: [3], [2,1], [1,2], [1,1,1].
a(4) = 8: [4], [3,1], [2,2], [2,1,1], [1,3], [1,2,1], [1,1,2], [1,1,1,1].
a(5) = 14: [5], [3,2], [3,1,1], [2,3], [2,2,1], [2,1,2], [2,1,1,1], [1,3,1], [1,2,2], [1,2,1,1], [1,1,3], [1,1,2,1], [1,1,1,2], [1,1,1,1,1].
		

Crossrefs

Column k=2 of A214248.

Programs

  • Maple
    b:= proc(n, i) option remember; `if`(n<1 or i<1, 0,
          `if`(n=i, 1, add(b(n-i, i+j), j=-2..2)))
        end:
    a:= n-> `if`(n=0, 1, add(b(n, j), j=1..n)):
    seq(a(n), n=0..50);
  • Mathematica
    b[n_, i_] := b[n, i] = If[n < 1 || i < 1, 0, If[n == i, 1, Sum[b[n-i, i+j], {j, -2, 2}]]]; a[n_] := If[n == 0, 1, Sum[b[n, j], {j, 1, n}]]; Table[a[n], {n, 0, 50}] (* Jean-François Alcover, Nov 06 2014, after Alois P. Heinz *)

Formula

a(n) ~ c * d^n, where d = 1.8630486786572002290749607226537419966705160765891889162715127426..., c = 0.6251341184281574379681933375704862852528326365321195333127800734... . - Vaclav Kotesovec, Sep 02 2014

A368557 Number of compositions of n such that the set of absolute differences is a subset of the set of parts.

Original entry on oeis.org

1, 1, 1, 3, 2, 2, 11, 10, 13, 27, 58, 87, 157, 253, 438, 850, 1462, 2474, 4472, 7716, 13544, 24115, 42360, 74013, 131038, 229009, 401946, 707293, 1242059, 2177682, 3828831, 6716062, 11777179, 20678592, 36267148, 63586772, 111556751, 195610763, 342949281
Offset: 0

Views

Author

John Tyler Rascoe, Dec 29 2023

Keywords

Examples

			For n=12, composition [2,1,2,4,3] of 12 has the set of absolute differences {1,2}, which is a subset of the set of parts {1,2,3,4}, so it counts towards a(12) = 157.
a(3) = 3 compositions: [3], [2,1], [1,2].
a(6) = 11 compositions: [6], [4,2], [2,4], [3,2,1], [3,1,2], [2,3,1], [2,1,3], [1,3,2], [1,2,3], [2,1,2,1], [1,2,1,2].
		

Crossrefs

Programs

  • Mathematica
    g[0] = {{}}; g[n_Integer] := g[n] = Flatten[ParallelTable[Append[#, i] & /@ g[n - i], {i, 1, n}], 1];
    isC[p_List] := Module[{d}, d = Abs[Differences[p]]; Union[d] === Union[Select[d, MemberQ[p, #] &]]];
    a[n_Integer] := a[n] = Count[g[n], p_ /; isC[p]];
    Monitor[Table[a[n], {n, 0, 19}], {n, Table[a[m], {m, 0, n - 1}]}] (* Robert P. P. McKone, Jan 02 2024 *)

Extensions

a(24)-a(38) from Alois P. Heinz, Dec 30 2023
Previous Showing 11-12 of 12 results.