Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I cant for the life of me figure this out, if someone could do this id be eterna

ID: 3768952 • Letter: I

Question

I cant for the life of me figure this out, if someone could do this id be eternally grateful

Program 2: Proper Divisor A proper divisor of a positive integer n is any divisor of n other than n itself. Thus, prime numbers have exactly one proper divisor, 1, and every other number has at least two proper divisors. For instance, 5 being prime has only one divisor, 1. 6 has as its divisors 1, 2, and 3 thus 6 is NOT prime. Create a program that allows the user to input a positive integer and outputs all positive proper divisors. If the number is prime, the program should state that to the user.

Explanation / Answer

Every integer greater than 1 has at least two divisors: itself and 1. These are the only divisors if and only if the number is prime. If an integer n greater than 1 is not prime then it can be expressed as a product rs with 1 < r < n and 1 < s < n. Then n is divisible by at least 1, r, s and n. This does not necessarily mean 4 divisors, since r may be equal to s. It is certainly the case that n 6= 1 and s is not equal to 1 or n; so there are at least three distinct divisors. And if there are only three then r must equal s, and s must be prime, for otherwise there would be a t with 1 < t < s and t|s, and t would be another divisor of n. So if n has exactly three divisors then it must be the square of a prime. Conversely, it is clear that if n = p 2 is the square of a prime, then n does have exactly three divisors, namely 1, p and n. If n = rs, where r and s are distinct primes then n has exactly four divisors: 1, r, s and n. If n = p 3 , where p is prime, then n has exactly 4 divisors: 1, p, p 2 and p 3 . We can use arguments similar to those above to show that these are the only circumstances under which n has exactly 4 divisors. Alternatively, we can make use of the formula proved in lectures: if n = p k1 1 p k2 2 · · · p kr r is the prime factorization of n then (n) = (k1 + 1)(k2 + 1)· · ·(kr + 1). Note that by hypothesis the primes p1, p2,

. . . , pr are distinct from one another and are divisors of n; so ki 1 for all i. Thus ki + 1 2 for all i, and so if r 3 then (n) (k1 + 1)(k2 + 1)(k3 + 1) 2 3 = 8. If r = 1 then (n) = k1 + 1 equals 4 if and only if k1 = 3, so that n is the cube of a prime. If r = 2 then (n) = (k1 + 1)(k2 + 1) 2 2 , with equality if and only if k1 + 1 = k2 + 1 = 2. This corresponds to n being the product of two distinct primes

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote