# find « prime « C Data Type Q&A

Home
C Data Type Q&A
 1 binary 2 bit 3 byte 4 char 5 character 6 decimal 7 Development 8 float 9 hex 10 integer 11 prime 12 random 13 struct
 C Data Type Q&A » prime » find

### 1. finding prime numbers    bytes.com

if you have a list 2 10 i want to find an algorithm that will find the prime numbers 2,3,5,7 very fast. but in a list 2 to 1000000 . like sieve algorithm. but the problem is that i don't understand exactly how to implement it correctly in C++ please guys i need some guidings hsn

### 2. Help trying to find prime numbers    bytes.com

Expert 2.5K+ P: 2,596 Ganon11 re: Help trying to find prime numbers It looks like your function should be working perfectly (although you can do a bit better by making it run until i is greater than sqrt(n), but this isn't going to affect the functionality) - is this your whole code, verbatim? Does it compile with any warnings? EDIT: Apart ...

### 3. Finding Prime Numbers    cboard.cprogramming.com

The lsqrt function is shamelessly lifted from there. The rest is mine. The standard library sqrt() were all quite slow and didnt work with unsigned long longs. "Thinking backwards, if it is divisible by 4, was it divisible by 2?" I'm not quite sure I see what you are getting at. If it was divisible by 2, we wouldnt ever be ...

### 5. finding out a prime number    forums.devshed.com

Google for "Sieve of Eratosthenes", which was invented in the third century BCE. Finds all odd prime numbers less than a given integer. It has often been used to benchmark computer performance. I accidentally rediscovered it 20 years ago when trying to automate finding dimensions for a 2D array with an arbitrary total number of elements that made it as square ...

### 6. finding if a number is prime and another ?    forums.devshed.com

I am doing this independent study on programming and i am stuck. How would u figure out if a number is prime? Is there a function u can call? My next question is how would u figure out if a number is a multiple of 7, 11, or 13. thanks in advance.

### 7. Finding the closest prime number    forums.devshed.com

I am trying to create a dynamic double hash, when the table becomes 80% full, I want to create a new table size that is the closest prime number that is greater than 2*(oldTableSize), then Iterate through my old table, hashing all of the values into my new table. I just don't know the easiest way to go about finding the ...

### 8. find the nth prime prime number    daniweb.com

And up to the 5 millionth prime number, in just 10 seconds? On what kind of PC? They have more efficient algorithms for this, but I can improve my "old reliable" program by using the idea that every non-prime number is divisible by a lesser prime number. So all the numbers being tested don't need to be tested against every odd ...

### 11. finding prime numbers that add up to even number?    daniweb.com

#include #include int even (int number); int prime (int number); int main () { int number, sum=0, divisor; printf ("Please enter a whole number: "); scanf ("%d", &number); if (number>=1) { prime (number); } return (0); } int even (int number) { return (!(number%2)); } int prime (int number) { if (even (number)) {