This project finds the prime factorization of any number less than or equal to 200000 (see why there's a limit in Notes and Credits). - Press the r key to set the range (all prime numbers between 0 and this number will be found and added to the "Prime" list) - Press the f key to enter a number to be factored - The factors are stored in a list and displayed in a variable How to use in your own project: First, you need to know how to use the scripts in the first place. The "Init" script must be run before the "Prime Factorize" script (but only once). Make sure the value set into the "Init" script when you run it is at least the highest number you are going to factorize (remember it can't go past 200000 either). Next, simply run the "Prime Factorize" script with whatever number you're factorizing. It will add each individual factor to the list called "Factors" where you can then use the numbers however you like. 1. Place the sprite called "Prime" into your backpack 2. Drag it out into your own project 3. Use it for whatever you want, and have fun 4. Give credit to me in the Notes and Credits section of your project! :)
I made the prime number calculating stuff in like 20 minutes. Then I spent two hours making it usable, lol. My first project shared within the day of starting. :) Why is there a number limit? This is why: In Scratch, a list can "only" hold 200000 items. This may sound like a lot, and it's sufficient for most things. In this project however, all the numbers between 2 and 200000 are stored in this list while the program finds the prime numbers. When the non-prime numbers have been filtered out, there are many fewer items in the list, but it still needs all 200000 items to generate. The only way I could get higher numbers would be to either add more lists, or make it multi-dimensional. Neither appealed to me because I was trying to make this quickly, and didn't want to spend a lot of time on it, as it's more of a proof of concept project at the moment. If you find any bugs/problems, let me know and I'll try to fix it! Tags: #Prime #Factor #Factorize #Factorization #Math