ScratchData LogoScratchData
Back to wwjd3's profile

Prime Number Finder

WWwwjd3•Created August 7, 2009
Prime Number Finder
5
3
560 views
View on Scratch

Description

This is a program to calculate prime numbers. It can calculate very quickly for smaller numbers, but the bigger ones take a few seconds each. For instance, I left it running for a little over 24 hours in turbo speed mode and it got the first 7,500 prime numbers and the first 68,714 composite numbers. How it works: If the number is 10, for instance, it will automatically add 1 and 10 to a list of factors, then check all the numbers 2-9 to see if any of them go into ten (it divides 10 by that number and checks if it is a whole number). Update: It now automatically adds even numbers to composite and only checks the odds. (2x faster) Update: It now adds the number to composite once it gets 1 factor, not having to finish up with the rest of that number. (about 10x faster) Update: It now only checks half of the number for factors, because the only quotient of a factor over half a number is 2... which means it would have gotten a factor before (about 2x faster)

Project Details

Project ID638856
CreatedAugust 7, 2009
Last ModifiedAugust 7, 2009
SharedAugust 7, 2009
Visibilityvisible
CommentsAllowed