A382411 a(n) is the greatest possible length of a circular sequence on n symbols such that: no two adjacent symbols are the same, any group of n adjacent symbols contains at least n-1 different symbols, and all groups of n adjacent symbols within the sequence are unique.
1, 2, 12, 96, 840, 7920, 80640, 887040, 10523520, 134265600, 1836172800, 26824089600, 417210393600, 6887085004800, 120306041856000, 2217815728128000, 43038178799616000, 877125197684736000, 18733345462960128000, 418459145406382080000, 9758369954796503040000, 237164153561075220480000
Offset: 1
Examples
Using symbols from the set {A, B, C} the sequence ABCACBCBABAC, when arranged in a circle, contains these 12 unique groups of three: ABC, BCA, CAC, ACB, CBC, BCB, CBA, BAB, ABA, BAC, ACA, and CAB. Each group contains at least two different symbols, no two adjacent symbols are the same, and the whole sequence contains the complete set of groups of three meeting these conditions. Hence, a(3)=12.
Links
- Dean D. Ballard, Table of n, a(n) for n = 1..50
- Dean D. Ballard, Proof of Formula
Programs
-
Mathematica
A382411[n_] := n!*(n*(n - 3) + 4)/2; Array[A382411, 25] (* Paolo Xausa, Apr 08 2025 *)