This project generates a list of permutations for a given number of digits. Scratch doesn't let lists surpass 200,000 items, so only digits 1-8 will work correctly. Feel free to backpack the sprite to use, if anyone has a use for something like this.
I will be working on optimizing the algorithm and even possibly creating a mathematical formula that can predict (or generate?) the next number if they were written as one long string. Updates: 5/18/21: Thought that ditching strings within lists would improve speed considerably (since flipping two numbers is much easier computationally), however, it only slowed down the algorithm. I'm wondering what the minimum possible amount of 'flips' or other kinds of actions could be for a given number of digits. I'm confident my algorithm is not the fastest. Okay so I just did some investigating (and by that I mean staring at sequences of numbers on a notebook for an hour), and my algorithm uses 7 flips to generator the permutations of 123; however, it is possible to do so in only 6. How you know which numbers to flip is the entire challenge of this project, and I will continue working on it. 5 flips is possible... can we get a 4? 5/6/21: Major optimization (30%) Made code a sprite you can backpack. Added thumbnail 5/5/21: Released