# Thread: How the heck to I find factors in Programming? (Need some quick help)

1. ## How the heck to I find factors in Programming? (Need some quick help)

I gotta do a quick program that asks for all the factors of 2 poitive numbers (include 1 and itself), the prime factorization of each, the least common multiple (LCM) of the two integers, and the greatest common factor (GCF) of the two integers.

The prime factorization stuff is whats giving me the problems.

I hope someone can help. Its appreciated

Thanks

2. a factor is generally any integer that when divided into another integer has no remainder. That is the same as seeing if the modulo is zero. Therefore if(num % div == 0) div is a factor of num. Exactly what you mean by prime factorization is unclear, unless you mean all integer factors or only factors that are prime. That is, the prime factors of 8 could be 1, 2, 8 but not 4 since 4 is just 2 * 2 and therefore not prime.

3. Ohh yea. I remember that stuff man. The problem is I dont know how to do that in a program. The only way I can think if doing it is by having the input number tested by every number individually. Is there a way to avoid that?