Question
Prime numbers are the building blocks of all integers greater than 1. Any integer n > 1 can be written as a unique product of
Prime numbers are the building blocks of all integers greater than 1. Any integer n > 1 can be written as a unique product of primes i.e. n = p1 p2 ... pm. Here, pi are primes such that p1 p2 ... pm. Take for example, the number 18. Itcanbewrittenas18=233. 1. Write a Python function primeDivisors(n) which accepts an integer n and returns the prime divisors as the output. The output must be in the form of a list. Bonus: Can you write a function primeDivisorsUnique(n) which ac- cepts an integer n and returns two outputs. The first output must be a list which contains all the unique prime divisors. The second output must be a list of how many times each of unique the prime divisors occur in the prime decomposition.For instance, for the number 18, the prime decomposition is 18 = 2 3 3. If 12 is passed in as the input to primeDivisorsUnique(n), it must return two lists. The first list would be [2, 3] and the second list would be [1, 2]. The first list is the list of unique prime divisors. The second list is the number of times each of them occur in the prime decomposition. In this instance, 2 occurs 1 time and 3 occurs 2 times. PLEASE USE PYTHON
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started