Sure. Read about the Sieve of Eratosthenes. Instead of checking for primality, you generate prime numbers.
More Related Contents:
- Program to find prime numbers
- Is a Recursive-Iterative Method Better than a Purely Iterative Method to find out if a number is prime?
- Enumerate factors of a number directly in ascending order without sorting?
- How do I implement the Sieve Of Eratosthenes using multithreaded C#?
- Conditional tests in primality by trial division
- c search for target string in string [closed]
- Here’s the code for arranging given numbers in ascending order . But when I submit it in Codechef it gives runtime(SIGSEGV) error?
- Infinite loop in C, codeblock [closed]
- Memory layout of C program
- String literals: Where do they go?
- What integer hash function are good that accepts an integer hash key?
- Does stack grow upward or downward?
- Function pointers and address of a function
- Reading string from input with space character? [duplicate]
- How to get the sign, mantissa and exponent of a floating point number
- How to capture Control+D signal?
- Multiple arguments to function called by pthread_create()?
- Why am I getting “undefined reference to sqrt” error even though I include math.h header? [duplicate]
- Undefined reference to ‘pthread_create’ — linker command option order (libraries before/after object files?) [duplicate]
- How does the C offsetof macro work? [duplicate]
- C – Difference between “char var[]” and “char *var”?
- Why does strchr take an int for the char to be found?
- Do temp variables slow down my program?
- #ifdef inside #define
- Function without return type specified in C
- What does a typedef with parenthesis like “typedef int (f)(void)” mean? Is it a function prototype?
- Where do the values of uninitialized variables come from, in practice on real CPUs?
- GCC 4.7 Source Character Encoding and Execution Character Encoding For String Literals?
- Questions about putenv() and setenv()
- How to use int16_t or int32_t with functions like scanf [duplicate]