Question: 4. Prime Numbers 4.1. [Python] Write a Python function is prime() to check whether an input value is a prime. That is, if the input
4. Prime Numbers 4.1. [Python] Write a Python function is prime() to check whether an input value is a prime. That is, if the input p is a prime number, then the function outputs 1. Otherwise, outputs 0. (@4%) 4.2. [Python] Please complete the following function, it factorizes the input n: (@6%) def factorization (n): if return n else: for j in range (2, int (math.sqrt (n)) +1, 1): if n % j == 0: return Example 1: print (factorization (10) The output is: Example 2: print (factorization (66)) The output is: Example 3: print (factorization (103)) The output is: 103
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
