Question
Write function q2(num) that takes a positive integer as input and returns a list of that number's prime divisors. You may copy and use the
Write function q2(num) that takes a positive integer as input and returns a list of that number's prime divisors. You may copy and use the numIsPrime function developed in class if you wish. Note: First, implement a correct algorithm for this problem, testing it on not-very-large numbers. Next, test it on 5003*5003+1 or similarly large numbers. If it takes a long long time on such numbers, consider whether you can re-organize your algorithm to make it faster. For this assignment, we won't deduct for inefficiency, but it's a good thing to think about. Examples:
>>> q2(36) [2,3] >>> q2(23) [23] >>> >>> q2(5003*5003+1) [2, 5, 2503001] >>> q2(4) [2] >>> q2(1) []
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