Today for some reason I dreamed about this problem, but I dont remember reading it anywhere. I was curious to know if the problem has a name and what the solution is. I'm no mathematician so I hope I don't make many expression blunders.
Given a random permutation of a set of n elements, Where each element has one, and exactly one matching element in the set different from itself. Find an expressión that calculates the probability of the set, for a given n, to not have any matching pairs contiguous to each other, and the probability of having exactly 1 matching pair contiguous. Do this assuming that the pair relations are not necessarily reciprocal, and again assuming that they are.
Thanks in advance.
Edit:
Lets take for example the case in which the relations are never reciprocal. Using the alphabet, lets asume that each letter matches the next one, for a list of size n, and that the last one matches the first one (otherwise the last element wouldn't have a match, even if the previous element has this one as his matching element, because the relations are never reciprocal). This can be understood as some kind of love triangle, A likes B, B likes C and C likes A.
I made a small program to check all combinations and the number of valid permutations by changing the size n, maybe this will make things a bit more clear:
N = 2 | Valid combinations: 0 | Example: None | Combinations: 2 | Probability: 0.0%
N = 3 | Valid combinations: 0 | Example: None | Combinations: 6 | Probability: 0.0%
N = 4 | Valid combinations: 0 | Example: None | Combinations: 24 | Probability: 0.0%
N = 5 | Valid combinations: 10 | Example: ECADB | Combinations: 120 | Probability: 8.3333%
N = 6 | Valid combinations: 60 | Example: FDBECA | Combinations: 720 | Probability: 8.3333%
N = 7 | Valid combinations: 462 | Example: GECFBDA | Combinations: 5040 | Probability: 9.1667%
N = 8 | Valid combinations: 3920 | Example: HFDGCAEB | Combinations: 40320 | Probability: 9.7222%
N = 9 | Valid combinations: 36954 | Example: IGEHFCADB | Combinations: 362880 | Probability: 10.1835%
N = 10 | Valid combinations: 382740 | Example: JHFIGECADB | Combinations: 3628800 | Probability: 10.5473%
N = 11 | Valid combinations: 4327510 | Example: KIGJHFDBECA | Combinations: 39916800 | Probability: 10.8413%
It seems like the probability of a permutation with no contiguous matching non reciprocal pairs increases as the size increases, which makes sense (I wonder what the probability is for the size of 7 billion).
This is not the same as this question Choose K items from N in a circle because in that question the new list has no matching elements in it, but in this one the list does have all, but ordered in such a way that they arent contiguous. The formula is not appliable.
I did a search of the sequence generated by the permutations, and seems to be similar to the Hertzsprung problem, the specific OEIS sequence for this: https://oeis.org/A002493.