Originally posted by ApolloCreed
Sorry I misunderstood.
And yes, a formula with N=3 is precisely what I meant!
To put the cart way ahead of the horse, the formula should also allow for different element lengths E. So if N=4 and E=2, the elements to consider ...[text shortened]... main example) algebraically is simple. But how to determine L?
Well, let me think about this.
So we have N = number of different items, E = number of items per element (with no repeated items in any one element), and L, which is the number of ways of organizing all possible elements (taking into account N and E) such that no item is adjacent to itself in it's neighboring element.
I'll define a new variable: R is the total number of possible orderings of all possible elements regardless of whether an item is adjacent to itself in it's neighbor. Therefore L is a subset of R.
Well, let's suppose N = 1. Clearly E must be 1 as well, since there are no repeated items per element. This leads me to realize E must be less than or equal to N.
If N = 1, then E = 1, and R and L both = 1.
If N = 2 and E = 1, we have A and B. R = 2, L = 2.
If N = 2 and E = 2, we have AB and BA. R = 2, L = 0.
If N = 3 and E = 1, we have A, B and C. R = 6, L = 6.
If N = 3 and E = 2, we have AB, AC, BA, BC, CA, CB. Now things get a little complex. R = 6!
Let's name another variable. P is the number of possible elements. Also let's write the initial conditions in the form (N,E).
(1,1) => R = 1, L = 1, P = 1
I'll write it in the form
(N,E) => (P,R,L)
(1,1) => (1,1,1)
Now P = N(N-1)(N-2)...(N-E). Right? R = P!.
This is all fairly simple (though I might have made a dumb mistake somewhere, check it would you?) But it doesn't give us L.
If we can determine how many orderings give us items adjacent to themselves, we've solved the problem. Hmm.
Let me check to make sure everything I've done so far works for the original example.
(3,2) => (6,720,L) = (6,6!,L)
It looks good so far!
Now, for (1,1), there are no possible illegitimate orderings; I = 0 (with I being the number of illegitimate orderings).
R-I = L; 1-0 = 1.
For (2,1), 2-I = 2. Therefore I = 0. Why? Clearly if E = 1, I = 0.
Ok, my brain is hurting. Maybe I will look at this later.