OFFSET
1,1
COMMENTS
The maximum number of copies of 123 in an alternating permutation is motivated in the Notices reference, and the argument here is analogous.
LINKS
Andrew Howroyd, Table of n, a(n) for n = 1..1000
Lara Pudwell, From permutation patterns to the periodic table, Notices of the American Mathematical Society. 67.7 (2020), 994-1001.
Index entries for linear recurrences with constant coefficients, signature (2,5,-12,-9,30,5,-40,5,30,-9,-12,5,2,-1).
FORMULA
a(2n) = 64*A050486(n-1) = 128*C(n+6,7) - 64*C(n+5,6).
a(2n-1) = 128*C(n+4,7) + 128*C(n+4,6) + 32*C(n+4,5).
D-finite with recurrence (-n+1)*a(n) +2*a(n-1) +16*a(n-2) +2*a(n-3) +(n+7)*a(n-4)=0. - R. J. Mathar, Jan 11 2024
G.f.: 32*x*(1 + x^2)/((1 - x)^8*(1 + x)^6). - Andrew Howroyd, Nov 18 2025
EXAMPLE
a(1) = 32. The alternating permutation of length 1+11=12 with the maximum number of copies of 1234567 is 132547698(11)(10)(12). The 32 copies are 12468(10)(12), 12469(10)(12), 12478(10)(12), 12479(10)(12), 12568(10)(12), 12569(10)(12), 12578(10)(12), 12579(10)(12), 13468(10)(12), 13469(10)(12), 13478(10)(12), 13479(10)(12), 13568(10)(12), 13569(10)(12), 13578(10)(12), 13579(10)(12), 12468(11)(12), 12469(11)(12), 12478(11)(12), 12479(11)(12), 12568(11)(12), 12569(11)(12), 12578(11)(12), 12579(11)(12), 13468(11)(12), 13469(11)(12), 13478(11)(12), 13479(11)(12), 13568(11)(12), 13569(11)(12), 13578(11)(12), and 13579(11)(12).
MAPLE
A339358 := proc(n)
nhalf := ceil(n/2) ;
if type(n, 'even') then
128*binomial(nhalf+6, 7)-64*binomial(nhalf+5, 6) ;
else
128*binomial(nhalf+4, 7)+128*binomial(nhalf+4, 6)+32*binomial(nhalf+4, 5) ;
end if;
end proc:
seq(A339358(n), n=1..40) ; # R. J. Mathar, Jan 11 2024
PROG
(PARI) a(n) = my(k=n\2); if(n%2, 128*binomial(k+5, 7) + 128*binomial(k+5, 6) + 32*binomial(k+5, 5), 128*binomial(k+6, 7) - 64*binomial(k+5, 6)); \\ Andrew Howroyd, Nov 18 2025
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Lara Pudwell, Dec 01 2020
STATUS
approved
