OFFSET
0,3
LINKS
Fausto A. C. Cariboni, Table of n, a(n) for n = 0..74 (terms 0..50 from Joerg Arndt and Alois P. Heinz).
EXAMPLE
There are a(6) = 19 such compositions of 6: [6], [5,1], [4,2], [3,3], [2,4], [1,5], [4,1,1], [2,3,1], [1,4,1], [1,3,2], [3,1,2], [2,1,3], [1,1,4], [2,2,1,1], [1,2,2,1], [2,1,2,1], [1,2,1,2], [2,1,1,2], [1,1,2,2].
MAPLE
b:= proc(n, l) local j, k, m; m:= nops(l);
for j to m-2 do for k from j+1 to m-1 do
if (l[m]-l[k])*(k-j)=(l[k]-l[j])*(m-k)
then return 0 fi od od;
`if`(n=0, 1, add(b(n-i, [l[], i]), i=1..n))
end:
a:= n-> b(n, []):
seq(a(n), n=0..20);
MATHEMATICA
b[n_, l_] := Module[{j, k, m = Length[l]}, For[ j = 1, j <= m - 2, j++, For[k = j+1, k <= m - 1 , k++, If[(l[[m]] - l[[k]])*(k - j) == (l[[k]] - l[[j]])*(m - k), Return[0]]]]; If[n == 0, 1, Sum[b[n - i, Append[l, i]], {i, 1, n}]]];
a[n_] := b[n, {}];
Table[a[n], {n, 0, 20}] (* Jean-François Alcover, May 21 2018, translated from Maple *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Joerg Arndt and Alois P. Heinz, Mar 02 2014
STATUS
approved