OFFSET
1,2
LINKS
FORMULA
a(n) = A143823(n) - 1. - Carl Najafi, Jan 16 2013
EXAMPLE
a(4) = 12: [1], [2], [3], [4], [1,2], [1,3], [1,4], [2,3], [2,4], [3,4], [1,2,4], [1,3,4]. - Alois P. Heinz, Jan 16 2013
MAPLE
b:= proc(n, s) local sn, m;
if n<1 then 1
else sn:= [s[], n]; m:= nops(sn);
`if` (m*(m-1)/2 = nops (({seq (seq (sn[i]-sn[j],
j=i+1..m), i=1..m-1)})), b(n-1, sn), 0) +b(n-1, s)
fi
end:
a:= proc(n) a(n):= b(n-1, [n]) +`if` (n=0, -1, a(n-1)) end:
seq(a(n), n=1..30); # Alois P. Heinz, Jan 16 2013
MATHEMATICA
b[n_, s_List] := b[n, s] = Module[{sn, m}, If[n < 1, 1, sn = Append[s, n]; m = Length[sn]; If[m(m - 1)/2 == Length @ Union @ Flatten @ Table[ Table[ sn[[i]] - sn[[j]], {j, i + 1, m}], {i, 1, m - 1}], b[n - 1, sn], 0] + b[n - 1, s]]];
a[n_] := a[n] = b[n - 1, {n}] + If [n == 0, -1, a[n - 1]];
Table[Print[n, " ", a[n]]; a[n], {n, 1, 41}] (* Jean-François Alcover, Apr 28 2020, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn
AUTHOR
John W. Layman, Apr 11 2000
EXTENSIONS
More terms from Carl Najafi, Jan 15 2013
STATUS
approved