C++ Primes?

From: Ryan Duchesne (catsanddogs19_at_hotmail.com)
Date: 11/29/03


Date: 29 Nov 2003 08:16:17 -0800

Hello I am trying to write a program which will have a loop in which
the program would then set the next 40 primes for each of the numbers
in the loop ie: p[40] will have 40 different primes for each k in the
loop. I guess it could look something like
for (int k=1; k<=10; k++)
  p[k]=nextprime(k);
I am not sure how to program this if anyone could give me any advice
or somewhere where I an download the program that would be great thank
you very much for your time.

Cheers,

Ryan Duchesne



Relevant Pages

  • Re: First Program Bug (Newbie)
    ... I used the incrementing command and incremented candidates by two to check only odds and now the program is a lot faster. ... head to write a program to print all the primes; ... The program prints some non-prime numbers. ... outer while loop: ...
    (comp.lang.python)
  • Re: First Program Bug (Newbie)
    ... head to write a program to print all the primes; ... The program prints some non-prime numbers. ... outer while loop: ... throw this away and use gmpy. ...
    (comp.lang.python)
  • Re: First Program Bug (Newbie)
    ... Although Python has built in Big ... the gmpy versions can sometimes run rings around ... All these false primes ... outer while loop: ...
    (comp.lang.python)
  • Re: [Algorithm] Sum of Primes < 1000000
    ... I saw no attack in Simon's post. ... The set was of primes, and the size of that is O, so 1/4 of that is O. ... For each p reached that's not gotten marked composite earlier, loop from p^2 until N step p. ... I concluded that the average length of the loop is bounded by O, and the whole algorithm by O. ...
    (comp.lang.java.programmer)
  • Re: [Algorithm] Sum of Primes < 1000000
    ... I saw no attack in Simon's post. ... There are Oprimes below N. At least one of these primes is at least N/2. ... loop from p^2 until N step p. ... could be approximated by the integral of the logarithm. ...
    (comp.lang.java.programmer)