Board index » delphi » Pascal code for finding prime numbers from 1 to 1000
Will
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT

Will
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Pascal code for finding prime numbers from 1 to 1000
I was wondering if anyone has code that can tell a user if there number they
input (1 to 1000) is a prime number? Anything would be appreciated as I'm very new to Pascal and I'm using Turbo Pascal 5.5. 
Mike Copela
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000Quote> I was wondering if anyone has code that can tell a user if there number they assignment) given to you? You'll benefit most from (1) researching what prime numbers are and (2) doing this exercise yourself. For one way, look up the Sieve of Erastosthenes (sp). 
ViLNiu
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000I have made a program made in TP7 which does this. Would you like to have the source? ViLNiuS Will <W...@hotmail.com> schreef in berichtnieuws Quote> I was wondering if anyone has code that can tell a user if there number 
Dr John Stockto
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000JRS: In article <3EbL4.1137$9B.147...@news.bc.tac.net> of Tue, 18 Apr 2000 22:40:16 seen in news:comp.lang.pascal.borland, Will Quote<W...@hotmail.com> wrote: For that limited range, however, it's best to note that any nonprime Prime := true ; J := 3 ; The fact that BREAK cannot be used in TP5.5 (IIRC) is left for you to You could make use of Sqrt too; and if you think how to you should also  
Clif Pen
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000QuoteOn Tue, 18 Apr 2000 22:40:16 0700, "Will" <W...@hotmail.com> wrote: "Euclid's Algorithm" and "Euclids's GCD" and you will find what you need to test prime numbers. For your relatively small number of 1,000 as a maximum, the Sieve of For lists of primes longer than this, Euclid's greatest common divisor Clif <clifp...@airmail.net> 
m..
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000QuoteWill <W...@hotmail.com> wrote: 10 or so lines of code, so it's not as difficult as it looks. 
Timo Sal
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000In article <3EbL4.1137$9B.147...@news.bc.tac.net>, QuoteWill <W...@hotmail.com> wrote: :input (1 to 1000) is a prime number? Anything would be appreciated as I'm 153) How can I test if an integer number is a prime? 165966 Jan 8 2000 ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip All the best, Timo  
Dr John Stockto
Delphi Developer 
Wed, 18 Jun 1902 08:00:00 GMT
Re:Pascal code for finding prime numbers from 1 to 1000JRS: In article <8dr320$...@loisto.uwasa.fi> of Sat, 22 Apr 2000 05:33:36 seen in news:comp.lang.pascal.borland, Timo Salmi <t...@UWasa.Fi> wrote: Quote>In article <3EbL4.1137$9B.147...@news.bc.tac.net>, gives the wrong result for n<2. One might be able to avoid a float operation (Sqrt) by using (n+1)^2 = fn := true ; j := 2 ; k := 4 ; Though that also fails for n=2; perhaps the loop should be changed to a  
1. 2  1000 digit numbers multiplier CODE
2. trying to find a prime number
3. Prime Number Finding Program
4. Help with cleaning code on subfunction used to check if number is a prime
5. prime numbers SQR in Pascal
6. PascalCode to find the number of floppyDrives
7. 1000 > 1,000.00 , home >Home