AA098
How do I make sure that with the formula of adding +1 to the exponent, I do not double count any factors? So also that 1 is counted only once
That's how the formula works.
Let's say the prime factorization of the number is \(p^a * q^b * r^c..\). where p, q, r are prime numbers and a, b, c are their respective exponents. The total number of factors of the given number is then \((a+1)(b+1)(c+1)...\). This will include 1 and the number itself.
Why? Because each factor includes zero or more instances of each prime number. If p is a factor, it might be there 0 times, 1 time, 2 times, all the way up to
a times. Hence, there are (a+1) possibilities for p, and similarly for q, r, and so on. Since these possibilities for each factor are independent, you multiply the possibilities to find the total.
For example, if a number is 36, its prime factors are 2 and 3. In terms of prime factorization, 36 can be written as 2^2 * 3^2. So, the total number of factors will be (2+1)*(2+1) = 9. These factors are 1, 2, 3, 4, 6, 9, 12, 18, 36.
I hope this makes it easier to understand.