# Endless eight swap

I have a pegboard with 10 pegholes numbered 1 to 10.

There are 10 pegs of different colours: dark blue, orange, violet, black, light gold, indigo, navy, green, ivory, and teal. Each peg initially is in the respective peghole. For example, violet is in hole #3 and ivory is in hole #9.

For each week that passes I will swap some pegs in certain pegholes:

1. 5 and 7
2. 3 and 5
3. 2 and 6
4. 1 and 8
5. 10 and 9
6. 2 and 5
7. 1 and 4
8. 9 and 1

(I will repeat all 8 swaps every week)

What will the colours be in the pegholes after 15,532 weeks have passed?

Hint:

Please answer in ~21 steps or less. There is also a much shorter way. Also the colours have almost nothing to do with the problem, there is no hidden hint.

Bonus

Only solutions listing at most 1 week are allowed

Hint for bonus

A diagram may help

• I think you missed two colors? – Dorrulf Nov 26 '18 at 23:42
• @Dorrulf my bad, it has been fixed – sunny-lan Nov 26 '18 at 23:44
• you can't delete questions with answers! – JMP Dec 18 '18 at 7:14

Firstly, we can see that:

there are two separate cycles, namely $$23567$$ (from swaps 1,2,3 and 6) and also $$1489A$$ (from swaps (4,5,7 and 8).

Next we can:

map out what happens to each cycle, namely:
$$23567\to23765\to27365\to67325\to37625$$
and
$$1489A\to8419A\to841A9\to481A9\to A8149$$

And as:

the order of every element is $$5$$, we conclude that the state of the pegs after $$15,532$$ weeks is the same as after $$2$$ weeks, namely:

$$9751236A84$$

After 5 weeks of making these moves, the pieces will all be back in their original locations. The weeks rotate as such: (using numbers instead of colors)
week 1
1 2 3 4 5 6 7 8 9 10 (holes)
9 3 7 8 6 2 5 1 10 4 (Pieces. Piece number being original placement)

week 2
1 2 3 4 5 6 7 8 9 10
10 7 5 1 2 3 6 9 4 8

week 3
1 2 3 4 5 6 7 8 9 10
4 5 6 9 3 7 2 10 8 1

week 4
1 2 3 4 5 6 7 8 9 10
8 6 2 10 7 5 3 4 1 9

week 5
1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10

Thus, the desired week can be modded by 5: 15532 mod 5 = 2, thus we're looking for the results at the end of the second week, which is described in placements above.

Back in colors:

This results in: teal, navy, light gold, dark blue, orange, violet, indigo, ivory, black, green.

Edit:

Well, originally I figured I would only have to do a small number of weeks based off the first week's rotation. But if we actually assess what's happening we can look at it like this:
After the first week, we notice the 1 is now in the 8th hole. Well then, based on the locations of the other numbers, how many 'jumps' will it take for one to get back to the first hole? Thus, just looking at the first week we can see that the 1 will have to make these movements to get back:
1->8->4->10->9->1, thus 5 rotations.
Knowing that, we can mod the number by 5 like before. Now, with trying to get 2 weeks, we can just follow each number 2x along it's path (kinda like we just did with 1). I hope this makes sense... But basically:
I need two hops. So, 1 will be: 1->8->4
2 will be: 2->6->5
etc.
Thus by accessing just the first week, and the number of hops we need, we can clearly reconstruct an arbitrary weeks setup (post modded 5) just by following a limited path for each number.
I hope this is more in terms of what you're looking for.
The resulting position movements:
1>8>4>10>9>1
2>3>7>5>6>2

Alright, well based on the last 3 lines of the previous section, this is interesting:

The 10 numbers can be broken into 2 rotating groups that each hold 5 of the numbers. This makes the process even more simple. If I wanna know where 3 is going to be in 4 jumps, I find which set has 3, start at 3's position, and hop to it! The result in this case would be the 2nd hole.

• Yes, that is the right answer, though due to a slight mistake in my swaps your answer wasn't my intended solution (oops). See the bonus I added: try thinking of a way where you only have to list one week :) – sunny-lan Nov 27 '18 at 0:18
• @sunny-lan maybe these edit items are closer to what you are looking for? – Dorrulf Nov 27 '18 at 0:42
• after week 1, I get that peg 10 should be in hole 1 – JMP Nov 27 '18 at 1:29
• Apparently I misunderstood the first comment. I see the transposition now. After all that other work too, dang. – Dorrulf Nov 27 '18 at 18:41