USE TURBO MODE!!!! (shift+green flag) I know it's like REALLY inefficient, but before I asked on the forums I came up with a method, but didn't fully complete it. This could definitely be a lot better, as it's REALLY inefficient. I'm going to try the methods on the forums later :D. It works quite quickly up until around 10000, but then it still only takes about 4 seconds.
thanks to Eric Codecire on yt for the prime number generator!