This is an explanation of my answer to the code golf question "Algorithmic Braiding - for mother's day". The problem asks this:
Your task is to create a program that, when given a number of strands and number of iterations of a braid, will tell where each strand goes.
We'll call the number of strands N
and the number of iterations I
. Let's start by looking at some simple outputs. The classic example is 3 strands:
1 2 3
\ iteration 1
2 1 3
/ iteration 2