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.

A238423 Number of compositions of n avoiding three consecutive parts in arithmetic progression.

Original entry on oeis.org

1, 1, 2, 3, 7, 13, 22, 42, 81, 149, 278, 516, 971, 1812, 3374, 6297, 11770, 21970, 41002, 76523, 142901, 266779, 497957, 929563, 1735418, 3239698, 6047738, 11289791, 21076118, 39344992, 73448769, 137113953, 255965109, 477835991, 892023121, 1665227859
Offset: 0

Views

Author

Joerg Arndt and Alois P. Heinz, Feb 26 2014

Keywords

Comments

These are compositions of n whose second-differences are nonzero. - Gus Wiseman, Jun 03 2019

Examples

			The a(5) = 13 such compositions are:
01:  [ 1 1 2 1 ]
02:  [ 1 1 3 ]
03:  [ 1 2 1 1 ]
04:  [ 1 2 2 ]
05:  [ 1 3 1 ]
06:  [ 1 4 ]
07:  [ 2 1 2 ]
08:  [ 2 2 1 ]
09:  [ 2 3 ]
10:  [ 3 1 1 ]
11:  [ 3 2 ]
12:  [ 4 1 ]
13:  [ 5 ]
		

Crossrefs

Cf. A238424 (equivalent for partitions).
Cf. A238569 (equivalent for any 3-term arithmetic progression).

Programs

  • Maple
    # b(n, r, d): number of compositions of n where the leftmost part j
    #             does not have distance d to the recent part r
    b:= proc(n, r, d) option remember; `if`(n=0, 1,
          add(`if`(j=r+d, 0, b(n-j, j, j-r)), j=1..n))
        end:
    a:= n-> b(n, infinity, 0):
    seq(a(n), n=0..45);
  • Mathematica
    b[n_, r_, d_] := b[n, r, d] = If[n == 0, 1, Sum[If[j == r + d, 0, b[n - j, j, j - r]], {j, 1, n}]]; a[n_] := b[n, Infinity, 0]; Table[a[n], {n, 0, 45}] (* Jean-François Alcover, Nov 06 2014, after Maple *)
    Table[Length[Select[Join@@Permutations/@IntegerPartitions[n],!MemberQ[Differences[#,2],0]&]],{n,0,10}] (* Gus Wiseman, Jun 03 2019 *)

Formula

a(n) ~ c * d^n, where d = 1.866800016014240677813344121155900699..., c = 0.540817940878009616510727217687704495... - Vaclav Kotesovec, May 01 2014