OFFSET
0,2
COMMENTS
Also the number of subsets of {1..n} with the same number of adjacent elements increasing by 1 as adjacent elements increasing by more than 1.
LINKS
Christian Sievers, Table of n, a(n) for n = 0..3328
FORMULA
Let M be the matrix [1,0,0; 1,x,1/x; 0,1,1]. Then a(n) is the sum of the constant terms of the entries in the left column of M^n. - Christian Sievers, Jul 06 2025
EXAMPLE
The set {2,3,5,6,8} has maximal runs ((2,3),(5,6),(8)) and maximal anti-runs ((2),(3,5),(6,8)) so is counted under a(8).
The a(0) = 1 through a(6) = 19 subsets:
{} {} {} {} {} {} {}
{1} {1} {1} {1} {1} {1}
{2} {2} {2} {2} {2}
{3} {3} {3} {3}
{4} {4} {4}
{1,2,4} {5} {5}
{1,3,4} {1,2,4} {6}
{1,2,5} {1,2,4}
{1,3,4} {1,2,5}
{1,4,5} {1,2,6}
{2,3,5} {1,3,4}
{2,4,5} {1,4,5}
{1,5,6}
{2,3,5}
{2,3,6}
{2,4,5}
{2,5,6}
{3,4,6}
{3,5,6}
MAPLE
a:= proc(n) option remember; `if`(n<5, [1, 2, 3, 4, 7][n+1], ((3*n-4)*a(n-1)-
(3*n-5)*a(n-2)+(5*n-12)*a(n-3)-2*(4*n-11)*a(n-4)+4*(n-3)*a(n-5))/(n-1))
end:
seq(a(n), n=0..35); # Alois P. Heinz, Jul 06 2025
MATHEMATICA
Table[Length[Select[Subsets[Range[n]], Length[Split[#, #2==#1+1&]]==Length[Split[#, #2!=#1+1&]]&]], {n, 0, 10}]
PROG
(PARI) a(n)=polcoef([1, 1, 1]*[x, 0, 0; x, x^2, 1; 0, x, x]^n*[1, 0, 0]~, n) \\ Christian Sievers, Jul 06 2025
CROSSREFS
KEYWORD
nonn
AUTHOR
Gus Wiseman, Jul 04 2025
EXTENSIONS
a(21) and beyond from Christian Sievers, Jul 06 2025
STATUS
approved
