ScratchData LogoScratchData
Back to MrFlightless's profile

Prime Number Finder

MRMrFlightless•Created June 11, 2016
Prime Number Finder
4
3
102 views
View on Scratch

Instructions

Green flag starts it SHIFT clicking the green flag toggles turbo mode UP arrow and DOWN arrow change the delay while it is running X pauses it S resumes it SPACE resets and stops it

Description

This is a simple program that uses trial division to find and list prime numbers. It will take a number and modulus that number with every odd number from 3 to it's square root, and if at any time the modulus is 0 then it will skip that number and move on to the next number. The delay adds to the amount of time that it generates prime numbers so they do not go by in a blur. While it is generating numbers, the delay can be changed with the UP and DOWN arrow keys. The starting number is the number that it will start with. It works with even or odd numbers. It will only generate positive numbers. If no or 0 delay is given then it will list prime numbers as fast as it can calculate them (even faster with turbo mode), The higher the number, the longer it takes to determine whether it is prime or not. Turbo mode makes it a lot faster. I got inspiration for this from the prime number generator SethBling had in his BASIC in Minecraft video (https://youtu.be/t4e7PjRygt0) Comment any suggestions, bugs or if it generates any composite numbers. Changelog: June 11 2016: Shared July 2 2016: Can now start at an even number July 20 2016: No longer says "Hello! [username]" at the beginning

Project Details

Project ID113401544
CreatedJune 11, 2016
Last ModifiedJune 21, 2017
SharedJune 11, 2016
Visibilityvisible
CommentsAllowed