A238423 Number of compositions of n avoiding three consecutive parts in arithmetic progression.
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
Keywords
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 ]
Links
- Joerg Arndt and Alois P. Heinz, Table of n, a(n) for n = 0..400
- Wikipedia, Arithmetic progression
Crossrefs
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
Comments