Question: urgent (python) Problem 1. Largest power In this problem, you are not allowed to use the Math module and any other module. a) Largest power

urgent (python)  urgent (python) Problem 1. Largest power In this problem, you are
not allowed to use the Math module and any other module. a)

Problem 1. Largest power In this problem, you are not allowed to use the Math module and any other module. a) Largest power of 2 dividing n. Implement the function largestPowerOf2 Dividing(n), which given a positive integer n, finds and returns the largest power of 2 which divides n. That is given n, largestPowerOf2Dividing(n) returns the largest i such that 2 divides n. Assume n is a positive integer. Test program Output print("a)") a) print(largestPowerOf2Dividing(1)) 0 print(largestPowerOf2Dividing(2)) 1 print(largestPowerOf2Dividing(3)) 0 print(largestPowerOf2Dividing(4)) 2 print(largestPowerOf2Dividing(5)) 0 print(largestPowerOf2Dividing(20)) 2 print(largestPowerOf2Dividing(48)) # 48 = 3 (2) 4 b) Largest power dividing n. Implement the function largest PowerDividing(n), which given a positive integer n, finds and returns the largest power of an integer greater than I which divides n. That is given n, largest Power Dividing(n) returns the largest i such that x' divides n, for some integer x > 1. For instance: largest PowerDividing(50) - 2 since 50 -2x5, and largest PowerDividing(362063535) = 6 since 362063535 - 3x5x17". Assume n is a positive integer. Test program Output print("b)") b) print(largestPowerDividing(1) print(largestPowerDividing(2)) 1 print(largestPowerDividing(3)) 1 print(largestPowerDividing(4)) 2 print(largestPowerDividing(5)) print(largestPower Dividing(9)) 2 print(largestPowerDividing(25)) 2 print(largestPower Dividing(50)) print(largestPower Dividing(162)) #162 - 2*(3**4) 4 print(largestPowerDividing(362063531)) 1 print(largestPowerDividing(362063535)) 1 NN

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!