Oh no. My day shall now be wasted.
Honestly cannot think about any more optimized algorithm given that we don’t have recursion in Coda. If the task was to only get permutations of a hard-coded length that would be easier.
We do have a sort of formulaic WHILE loops in Coda so let me give it a try with two formulas recursively updating each other.