OFFSET
0,4
COMMENTS
Same as A145874.
LINKS
David Scambler et al., A147681 Late-growing permutations and follow-up messages on the SeqFan list, Aug 10 2012
MAPLE
a:= proc(n) option remember; local b, m; m:= n*(n+1)/2;
b:= proc(s) option remember; local h, g; h:= nops(s);
g:= (n-h+1)*(1+n)/2 -m +add(i, i=s); `if`(h<2, 1,
add(`if`(s[i]<=g, b(subsop(i=NULL, s)), 0), i=1..h))
end; forget(b);
b([$1..n])
end:
seq(a(n), n=0..15); # Alois P. Heinz, Aug 10 2012
MATHEMATICA
a[n_] := a[n] = Module[{b, m}, m = n*(n+1)/2; b[s_List] := b[s] = Module[{h, g}, h = Length[s]; g = (n-h+1)*(1+n)/2 - m + Total[s]; If[h<2, 1, Sum[If[s[[i]] <= g, b[ReplacePart[s, i -> Sequence[]]], 0], {i, 1, h}]]]; b[Range[n]]]; Table[a[n], {n, 0, 15}] (* Jean-François Alcover, Mar 13 2015, after Alois P. Heinz *)
CROSSREFS
KEYWORD
nonn,hard
AUTHOR
R. H. Hardin, May 01 2009
EXTENSIONS
a(22) from Alois P. Heinz, Aug 10 2012
a(23) from Alois P. Heinz, Nov 01 2014
a(24)-a(25) from Vaclav Kotesovec, Jan 31 2015
a(26)-a(27) from Vaclav Kotesovec, Sep 07 2016
STATUS
approved