OFFSET
5,1
FORMULA
a(n) = (n-3)! * (n^3 - 11*n^2 + 44*n - 64).
EXAMPLE
For n=5, our base letter sequence is "AAABB". In its 120 permutations (5! = 120), there are 12 instances of "ABABA", the only letter sequence where neither A's nor B's are adjacent to themselves. This can be represented visually by using upper and lower case, and a diacritic in the case of the third "A": ABabá, AbaBá, aBAbá, abABá, áBAba, ábABa, ABába, AbáBa, aBábA, abáBA, áBabA, and ábaBA.
For n=6, the base sequence is "AAABBC", which has 720 (6!) permutations. There are similarly 12 instances of each of the 10 letter sequences that don't duplicate A's or B's, namely ABABAC, ABABCA, ABACAB, ABACBA, ABCABA, ACABAB, ACBABA, BABACA, BACABA, and CABABA, making 120 distinguishable permutations that fit this rule.
MAPLE
A266393:=n->(n-3)!*(n^3 - 11*n^2 + 44*n - 64): seq(A266393(n), n=5..25); # Wesley Ivan Hurt, Jan 01 2016
MATHEMATICA
Table[(n - 3)!*(n^3 - 11*n^2 + 44*n - 64), {n, 5, 30}] (* Wesley Ivan Hurt, Jan 01 2016 *)
PROG
(Magma) [Factorial(n-3)*(n^3 - 11*n^2 + 44*n - 64) : n in [5..30]]; // Wesley Ivan Hurt, Jan 01 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Curtis Autery, Dec 28 2015
STATUS
approved