Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The PRIME NUMBERS
#58
Oracle:
This is a different problem than finding all primes up to a number.

AFAIK, to check if a number is prime you must check if it's divisible by some prime from 2 to the suare root of the number.
It means if your number is 2^62 you must have all the primes from 2 to 2^31 in a table. There are aproximately 100 million primes in that range. You coud calculate them previously and save them in a table. Rich Geldreich's progam generates in 1 hour such a table and stores it in a compressed format, 1 byte per prime but be aware the table is 100 Meg in size...
A less bloated approach would be to divide by every number from 2 to square root of n, it would work but it would be very inefficient.
Antoni
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)