Computer Science Canada Prime Number Finder |
Author: | TheXploder [ Fri Feb 20, 2004 12:39 pm ] | ||
Post subject: | Prime Number Finder | ||
Here is a program that finds prime numbers (divisible by itself and 1):
This could be sead up a bit, if I cancel out all numbers with a 5 or 0 at the end, or the numbers that are divisible by a previous prime number, can't be prime anymore... I used this website to check them aswell: http://www.utm.edu/research/primes/lists/small/1000.txt If you like please play around with it and try to beat me at finding the prime numbers: I am currently at prime number: 12739 ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ohh, wait: 16229 |
Author: | Tony [ Fri Feb 20, 2004 2:10 pm ] |
Post subject: | |
maybe you should check out this tutorial ![]() |
Author: | the_short1 [ Sat Feb 21, 2004 11:11 pm ] |
Post subject: | |
hahah... yea Tony's prog... it worked in 12 sec to produce to 1million produces a text file will all prime numbers in it... from 2 > million (with a 120 MHZ peice of crap) WOW... that post is old too... 1y... at time when admins didnl;t have steady 2000 bits |
Author: | TheXploder [ Sat Feb 21, 2004 11:46 pm ] |
Post subject: | |
thanx for that program Tony... |
Author: | Andy [ Sun Feb 22, 2004 2:00 pm ] |
Post subject: | |
if u want a really good one, do some string manipulation, so u can store 255 digit numbers |
Author: | Tony [ Sun Feb 22, 2004 11:47 pm ] |
Post subject: | |
why not just use a char array then? you can make your arrays much larger then 255 ![]() |
Author: | Andy [ Mon Feb 23, 2004 10:49 am ] |
Post subject: | |
good point |
Author: | Andy [ Mon Feb 23, 2004 10:50 am ] |
Post subject: | |
how about a flexiable array of strings? |
Author: | rizzix [ Tue Feb 24, 2004 11:59 pm ] |
Post subject: | |
aah but turing arrays have a limit of 1M elements. using a string class i created will let u manipulate on an infinite number of characters. ![]() |
Author: | Tony [ Wed Feb 25, 2004 12:58 am ] |
Post subject: | |
you can always start writing numbers down on your harddrive ![]() |
Author: | BlAcK TuRtLe [ Sun Feb 29, 2004 2:34 pm ] | ||
Post subject: | |||
This is a variation of your code which lets the user enter a number then finds out whether or not its prime.
|