OFFSET
1,2
COMMENTS
n is followed by the sequence floor(n/2), floor(n/2)-1, ..., 1.
REFERENCES
Mircea Merca, Binary Diagrams for Storing Ascending Compositions, Comp. J., 2012, (DOI 10.1093/comjnl/bxs111)
FORMULA
If n=k^2 or n=k^2+k then a(n) = ceiling(sqrt(4*n))-1, otherwise a(n) = floor((ceiling(sqrt(4*n))^2)/4) - n.
EXAMPLE
1,
2, 1,
3, 1,
4, 2, 1,
5, 2, 1,
6, 3, 2, 1,
7, 3, 2, 1,
8, 4, 3, 2, 1,
9, 4, 3, 2, 1,
10, 5, 4, 3, 2, 1,
11, 5, 4, 3, 2, 1,
12, 6, 5, 4, 3, 2, 1,
13, 6, 5, 4, 3, 2, 1,
14, 7, 6, 5, 4, 3, 2, 1,
15, 7, 6, 5, 4, 3, 2, 1,
16, 8, 7, 6, 5, 4, 3, 2, 1
MAPLE
seq(piecewise(floor((1/4)*ceil(sqrt(4*n))^2)-n = 0, ceil(sqrt(4*n))-1, 0 < floor((1/4)*ceil(sqrt(4*n))^2)-n, floor((1/4)*ceil(sqrt(4*n))^2)-n), n=1..50)
MATHEMATICA
Table[{n, Range[Floor[n/2], 1, -1]}, {n, 20}]//Flatten (* Harvey P. Dale, Jul 16 2017 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Mircea Merca, Sep 10 2012
STATUS
approved