Oof!
Oh my goodness, are you alright? I'm terribly sorry, I wasn't watching myself and...
...I see. I'm glad you're not too badly hurt. ...oh goodness! Your pecan muffins! They're all over the ground! My word, how much are they? I'll pay for another box, it's the least I can do!
No no, I won't hear another word!
Um...I'm sorry for shouting. I'm...told I need to be firmer, but I don't always like it. But I do know sometimes you have to be.
...wait. I recognise you. Are you that pony who helped Pinkie out? She said you always pick up pecan muffins from her place and...
You are? Um...I'm Fluttershy, by the way. If you're that pony, then...could you maybe...solvealittletteenytinyproblemfor me? Um...if that's alright with you...
Oh, not for free, obviously. I'll pay for a new box of muffins. And...maybe a few front row seats to the Summer Sun Celebrations? It's not far off, after all.
I'm in charge of music again, and I've got my usual choir of songbirds ready to play. This year though, I'm not composing the song...um, not entirely. One of the nobles from Canterlot is visiting, and there's a good chance she's coming to Ponyville for it. The song's for her, but she make some rather odd requests for the song.
Firstly, my bird choir is only allowed to sing in four notes: A, B, C and D, all in their major keys. No minor keys here. I can conduct the choir's singing in any order of four sequentially, there are many different combinations, but she said each combination of four must have one note each.
Secondly, I must include EVERY possible combination once and only once.
Thirdly, I am not allowed to change the position of any more than two notes in between combinations.
Fourthly, I cannot have the same note starting or ending each combination any more than twice in a row.
Finally, she wants the choir to be able to sing the song on a loop continuously, without breaking the previously mentioned rules.
Well, I believe once the melody has been sorted out, the accompaniment should be easy to sort out, but if you could compose the main theme for me, I would greatly appreciate it...um...but you don't have to if you don't want to...I'm just saying...
...you'll do it? Oh thank goodness. It's a good thing you like puzzles so much...or that's what Pinkie says, anyway...
ABCD ABDC BADC BACD CABD CADB DACB DABC ADBC ADCB BDCA BDAC CDAB CDBA DCBA DCAB ACDB ACBD BCAD BCDA CBDA CBAD DBAC DBCA
Took me a while, but I managed to find the pattern
You said major keys but I think you mean naturals (no sharps or flats). There are many keys containing ABCD all natural. In particular, this seems to be A minor or C major.
My thoughts on a solution - in order to satisfy rules 3 and 4, every move has to be in a different one of these sets than the two moves around it: {(12), (13)} , {(24),(34)} , {14}. So, you can do (13), (24), (14) but not (12), (13)
Now, there are 24 states. There are 6 states with B in the 2nd slot, say. We can do a saturation that hits every state with B in the 2nd slot once, like, say,
ABCD (13) CBAD (34) CBDA (13) DBCA (34) DBAC (13) ABDC… and then we swap something else into the second slot, so we slip in a (24) to put us into ACDB. Then we do the same (13), (34) alternation until we've saturated out the possibilities of C being in the second slot…
(13) DCAB (34) DCBA (13) BCDA (34) BCAD (13) ACBD… Now, we're going to want to do something different here, but let's see what would happen if we went ahead with (24) to put D in the second slot. … ADBC (13) BDAC (34) BDCA (13) CDBA (34) CDAB (13) ADCB … but now we would hit ABCD by applying a (24) since we were just rotating between having B, C, and D in the second slot.
Okay, to better visualize this I draw the sets in a circle, alphabetized, and draw the allowed transitions. 12 and 13 are blue and purple, and 24 and 34 are red and orange. 14 is black. Can't use orangish or bluish twice in a row.
Or maybe I should have arranged them in two circles of 12 one above the other in the Z direction, one with the odd permutations and one with the even permutations?
Haven't solved it yet, but it's the most interesting I've seen of them, especially since I'm trying to solve it methodically instead of just bash an answer out (I would not be surprised if there are many valid answers, but also not surprised if there's only one).
This reminds me of the Gray code. However there might be allowed repetitions.
If they might, then it probably should be like this:
A-A-A-A, A-A-A-B, B-A-A-B, B-A-A-C, C-A-A-C, C-A-A-D, D-A-A-D, D-A-A-A,
A-A-B-A, A-A-B-B, B-A-B-B, B-A-B-C, C-A-B-C, C-A-B-D, D-A-B-D, D-A-B-A,
A-A-C-A, A-A-C-B, B-A-C-B, B-A-C-C, C-A-C-C, C-A-C-D, D-A-C-D, D-A-C-A,
A-A-D-A, A-A-D-B, B-A-D-B, B-A-D-C, C-A-D-C, C-A-D-D, D-A-A-D, D-A-D-A,
A-B-A-A, A-B-A-B, B-B-A-B, B-B-A-C, C-B-A-C, C-B-A-D, D-B-A-D, D-B-A-A,
A-B-B-A, A-B-B-B, B-B-B-B, B-B-B-C, C-B-B-C, C-B-B-D, D-B-B-D, D-B-B-A,
A-B-C-A, A-B-C-B, B-B-C-B, B-B-C-C, C-B-C-C, C-B-C-D, D-B-C-D, D-B-C-A,
A-B-D-A, A-B-D-B, B-B-D-B, B-B-D-C, C-B-D-C, C-B-D-D, D-B-A-D, D-B-D-A,
A-C-A-A, A-C-A-B, B-C-A-B, B-C-A-C, C-C-A-C, C-C-A-D, D-C-A-D, D-C-A-A,
A-C-B-A, A-C-B-B, B-C-B-B, B-C-B-C, C-C-B-C, C-C-B-D, D-C-B-D, D-C-B-A,
A-C-C-A, A-C-C-B, B-C-C-B, B-C-C-C, C-C-C-C, C-C-C-D, D-C-C-D, D-C-C-A,
A-C-D-A, A-C-D-B, B-C-D-B, B-C-D-C, C-C-D-C, C-C-D-D, D-C-A-D, D-C-D-A,
A-D-A-A, A-D-A-B, B-D-A-B, B-D-A-C, C-D-A-C, C-D-A-D, D-D-A-D, D-D-A-A,
A-D-B-A, A-D-B-B, B-D-B-B, B-D-B-C, C-D-B-C, C-D-B-D, D-D-B-D, D-D-B-A,
A-D-C-A, A-D-C-B, B-D-C-B, B-D-C-C, C-D-C-C, C-D-C-D, D-D-C-D, D-D-C-A,
A-D-D-A, A-D-D-B, B-D-D-B, B-D-D-C, C-D-D-C, C-D-D-D, D-D-A-D, D-D-D-A.
If it's got a flaw, I should see. I am not sure I understood the rule of changing position. Same note (say, A), if repeated in the next sequence, gets placed at a new position?
If repetitions are not allowed, then:
The first note may be either of the four. The second -- either of the three remaining. The third -- either of the two remaining, and the fourth may be the only left.
How many combinations are there? 4 * 3 * 2 * 1 = 24. Here they are as follows:
A-B-C-D, A-B-D-C, (1)
A-C-B-D, A-C-D-B, (2)
A-D-B-C, A-D-C-B, (3)
B-A-C-D, B-A-D-C, (4)
B-C-A-D, B-C-D-A, (5)
B-D-A-C, B-D-C-A, (6)
C-B-A-D, C-B-D-A, (7)
C-A-B-D, C-A-D-B, (8)
C-D-B-A, C-D-A-B, (9)
D-A-C-B, D-A-B-C, (10)
D-C-A-B, D-C-B-A, (11)
D-B-A-C, D-B-C-A. (12)
(1)-(7), (12)-(1).
Note, that two notes changing their positions are the only way to transit from one sequence to another. Now, how do we arrange the choir? We must upon every transition change either the first or the last note of a sequence, and there may be three ways of changing. It might be as follows: (1)-(4), (8)-(2), (10)-(3), (6)-(12), (7)-(5), (11)-(9). This way we pass them all. However we must loop it somehow, and there's no way to perform a transition back to (1)... or is there?
Ah, what the heck!