Prime number finder

Hello guys, I'm new to programming, I had some Pascal classes last year and I found it pretty interesting, so I've given it a try and began doing some projects at home.

Recently I was thinking of how useful a prime number finder would be. And Im pretty sure there are millions out there, but I tried to build my own.
. After some struggle (and perhaps, as you'll see, some redundancies) I've came up with my own design. You enter the lower and upper values and the program will give you all the primes between both values. Problem is, it stops after "finding" the number 61. No matter what range I use! Could you please help me out?


  • quikcarlxquikcarlx Hollywood, Fl
    I don't know about your program and the problems that you are having. I have written a prime number finder that goes from 3 to 1,000,000 putting the results in a file, which you can change if you change my program. But first some rules that I use:
    { Prime determination from 4 rules: }
    { 1) all primes greater than 2 are odd }
    { 2) it's necessary to try division by all lower primes, but there's no }
    { efficient way to do this, so MOST odd numbers starting from 3 are used }
    { 3) it's necessary to try odd divisors only up to the square root of the }
    { new trial prime number (beyond that you would be traversing a range of }
    { numbers already ruled out) }
    { 4) prime numbers above 2 end either in 1, 3, 5, 7, or 9, it is un- }
    { necessary to test for numbers ending in 5, since they are divisible }
    { by 5 }
    Now I have honed and refined my algorithm for accuracy and speed and by using Free Pascal 2.6.0 compiler. So as an attachment, you can download the program, and give credit where credit is due.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!