How do I print out all prime factors in C and all the distinct prime factors of the inputted number. when a user enter a number less 2000. The user should be prompted to enter another number until the user wishes to quit.
How do I print out all prime factors in C and all the distinct prime factors of the inputted number. when a user enter a number less 2000. The user should be prompted to enter another number until the user wishes to quit.
-Duplicate threads removed and renamed-
Take your best shot at it. If it doesn't work, post your source code, and details of what went wrong and what you need help with.
The way I did it was to seed an array with the first few primes and then use a "divide by prime" scheme that built up the array dynamically to include higher primes. I managed to get it to match up to a few million then lost interest in prime numbers.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge