Results 1 to 3 of 3

Math Help - finding first n semi-prime integers

  1. #1
    Member
    Joined
    Nov 2010
    Posts
    95

    finding first n semi-prime integers

    HI, i am trying to find the first 2000,000 square free semi-prime numbers( mathWorld , oeis). I have generated the prime numbers but to get these semi-prime numbers i am trying as follows:

    Code:
    int limit1 = 1000;
    int limit2 = 2000;
    for(i=0;i<=limit1;i++)
    {
        for(j=i+1;j<=limit2;j++)
        {
            semiPrimes[size++]=(primes[i]*primes[j]);
        }
        limit2++;
    }
    however on chaging either limit1 or limit2 gives different values for semiprime[200000] . So what should be correct values of these variables?
    Thanks.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Senior Member
    Joined
    Jan 2008
    From
    UK
    Posts
    484
    Thanks
    66

    Re: finding first n semi-prime integers

    Your list is not in order.

    You will get 6,10,14,22,26,..............,15,21,33,39,......... ...........35,55,65.......etc
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Nov 2010
    Posts
    95

    Re: finding first n semi-prime integers

    Quote Originally Posted by a tutor View Post
    Your list is not in order.

    You will get 6,10,14,22,26,..............,15,21,33,39,......... ...........35,55,65.......etc
    that i am managing by sorting the semiPrime array after going out of both loops
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: November 14th 2011, 05:18 PM
  2. Relatively Prime Set of Integers
    Posted in the Number Theory Forum
    Replies: 3
    Last Post: May 15th 2010, 12:32 AM
  3. Relatively prime integers
    Posted in the Discrete Math Forum
    Replies: 1
    Last Post: April 26th 2010, 08:49 AM
  4. Replies: 3
    Last Post: October 21st 2009, 07:58 PM
  5. relatively prime integers....
    Posted in the Number Theory Forum
    Replies: 3
    Last Post: March 16th 2008, 01:00 PM

Search Tags


/mathhelpforum @mathhelpforum