Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The PRIME NUMBERS
#70
Quote:Mine got till the LONG overflow, that is up to and including 7FFFh Wink
And just in 1,5 hour


It wasn't made in QB Smile. However, these are the test results with my program made in QB:

1 min: 2,000,000
2 min: 4,031,482
1 h: 240,482,843


Hey Neo...I'm fiddling with C the last couple days...here's a c port of my basic primer finder...on my 1.5 GHz after 6 min, the biggest prime was 190,976,059. This looks similar to what you reported re flipping the signed 4-byte int after 1.5 hr...Mine uses unsigned, so I get to go all the way to ffffffff, instead of cutting short at 7fffffff. Cheers.

Code:
#include <iostream>

using namespace std;

int main()
{
    unsigned short inc = 1;
    unsigned long c;
    unsigned long x;
    unsigned long stop;
    unsigned long count=0;
    unsigned long hold=1;
    unsigned short array[6540]={3};
        
    
    cout << "Find primes up to what number?  (4,200,000,000 max)\n";
    cin >> stop;
    
    for (x=3; x<65536;x += 2)  //get small primes, put in array
    {      
        for (c=0; (x % array[c]) && (array[c]*array[c] < x)  ; c++);
        if (x % array[c])
        {
             //cout << x << " ";   //use this line to show all primes
             array[inc++]=x;
        }  
    }
    
    for (x=65537; x<stop;x += 2)  //find large primes
    {
        for (c=0; (x % array[c]) && (array[c]*array[c] < x)  ; c++);
        if (x % array[c])
        {
             //cout << x << " ";   //use this line to show all primes
             if (count++ > hold)
             {
             cout << x << " ";     //print every 100000th prime
             hold += 100000;
             }
        }  
    }
            
    cout << "\n done\n";
    return 0;
}
Reply


Messages In This Thread
The PRIME NUMBERS - by Touf - 05-05-2003, 05:46 AM
The PRIME NUMBERS - by toonski84 - 05-05-2003, 06:03 AM
The PRIME NUMBERS - by Plasma - 05-05-2003, 06:09 AM
The PRIME NUMBERS - by Touf - 05-05-2003, 05:54 PM
The PRIME NUMBERS - by Touf - 05-07-2003, 08:23 AM
The PRIME NUMBERS - by Mango - 05-07-2003, 11:51 PM
The PRIME NUMBERS - by ak00ma - 05-08-2003, 01:25 AM
The PRIME NUMBERS - by RST - 05-08-2003, 01:34 AM
The PRIME NUMBERS - by DrV - 05-08-2003, 05:52 AM
The PRIME NUMBERS - by Agamemnus - 05-08-2003, 08:04 AM
The PRIME NUMBERS - by RST - 05-08-2003, 07:12 PM
The PRIME NUMBERS - by Touf - 05-08-2003, 10:22 PM
The PRIME NUMBERS - by Touf - 05-12-2003, 05:47 PM
The PRIME NUMBERS - by Mango - 05-12-2003, 07:53 PM
The PRIME NUMBERS - by Touf - 05-13-2003, 02:52 AM
The PRIME NUMBERS - by wizardlife - 05-13-2003, 03:11 AM
The PRIME NUMBERS - by Antoni Gual - 05-14-2003, 02:31 AM
The PRIME NUMBERS - by Touf - 05-29-2003, 05:46 AM
The PRIME NUMBERS - by Mango - 05-29-2003, 10:16 PM
The PRIME NUMBERS - by Touf - 06-02-2003, 04:31 PM
And the Russians beat the French. - by Agamemnus - 06-02-2003, 11:34 PM
The PRIME NUMBERS - by toonski84 - 06-02-2003, 11:39 PM
Re: And the Russians beat the French. - by Mango - 06-03-2003, 01:09 AM
The PRIME NUMBERS - by Antoni Gual - 06-03-2003, 01:44 AM
The PRIME NUMBERS - by Agamemnus - 06-03-2003, 01:49 AM
The PRIME NUMBERS - by whitetiger0990 - 06-03-2003, 01:56 AM
The PRIME NUMBERS - by Antoni Gual - 06-03-2003, 02:47 AM
The PRIME NUMBERS - by Agamemnus - 06-03-2003, 03:02 AM
Toonski - by Mango - 06-03-2003, 04:32 AM
The PRIME NUMBERS - by toonski84 - 06-03-2003, 04:42 AM
The PRIME NUMBERS - by Antoni Gual - 06-03-2003, 04:48 AM
Antonio...re not using squareroots... - by Mango - 06-03-2003, 05:21 AM
The PRIME NUMBERS - by Antoni Gual - 06-03-2003, 05:37 AM
The PRIME NUMBERS - by Touf - 06-03-2003, 02:07 PM
The PRIME NUMBERS - by Touf - 06-03-2003, 05:09 PM
WHAT! WheRE DID MY POST GO? - by Agamemnus - 06-03-2003, 09:15 PM
The PRIME NUMBERS - by Antoni Gual - 06-03-2003, 10:51 PM
The PRIME NUMBERS - by toonski84 - 06-03-2003, 11:04 PM
The PRIME NUMBERS - by Agamemnus - 06-03-2003, 11:10 PM
The PRIME NUMBERS - by toonski84 - 06-03-2003, 11:16 PM
The PRIME NUMBERS - by ak00ma - 06-04-2003, 12:04 AM
The PRIME NUMBERS - by Touf - 06-04-2003, 12:18 AM
The PRIME NUMBERS - by Antoni Gual - 06-04-2003, 01:01 AM
The PRIME NUMBERS - by Agamemnus - 06-04-2003, 01:43 AM
The PRIME NUMBERS - by whitetiger0990 - 06-04-2003, 01:52 AM
The PRIME NUMBERS - by Neo - 06-04-2003, 02:42 PM
The PRIME NUMBERS - by Mango - 06-04-2003, 07:48 PM
The PRIME NUMBERS - by Antoni Gual - 06-05-2003, 04:13 AM
The PRIME NUMBERS - by Agamemnus - 06-05-2003, 04:19 AM
The PRIME NUMBERS - by Neo - 06-05-2003, 12:12 PM
The PRIME NUMBERS - by Antoni Gual - 06-06-2003, 07:01 PM
The PRIME NUMBERS - by Joakim - 06-08-2003, 02:21 AM
The PRIME NUMBERS - by Agamemnus - 06-08-2003, 04:25 AM
The PRIME NUMBERS - by Antoni Gual - 06-08-2003, 06:20 PM
The PRIME NUMBERS - by whitetiger0990 - 06-09-2003, 04:34 AM
The PRIME NUMBERS - by Antoni Gual - 06-09-2003, 05:01 AM
The PRIME NUMBERS - by oracle - 06-09-2003, 05:12 AM
The PRIME NUMBERS - by Antoni Gual - 06-09-2003, 05:45 AM
The PRIME NUMBERS - by oracle - 06-09-2003, 05:46 AM
The PRIME NUMBERS - by Agamemnus - 06-09-2003, 06:59 AM
The PRIME NUMBERS - by whitetiger0990 - 06-09-2003, 07:24 AM
The PRIME NUMBERS - by Agamemnus - 06-09-2003, 07:30 AM
The PRIME NUMBERS - by whitetiger0990 - 06-09-2003, 07:36 AM
The PRIME NUMBERS - by Agamemnus - 06-09-2003, 11:07 PM
The PRIME NUMBERS - by Mango - 06-09-2003, 11:39 PM
The PRIME NUMBERS - by Antoni Gual - 06-09-2003, 11:53 PM
The PRIME NUMBERS - by whitetiger0990 - 06-10-2003, 12:55 AM
The PRIME NUMBERS - by oracle - 06-10-2003, 06:11 AM
The PRIME NUMBERS - by Antoni Gual - 06-11-2003, 03:01 AM
The PRIME NUMBERS - by Mango - 06-13-2003, 12:55 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)