4 Prime Numbers 41 Python Write Python Function Prime Check Whether Input Value Prime Inpu Q43843167
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 Show transcribed image text 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
Expert Answer
Answer to 4. Prime Numbers 4.1. [Python] Write a Python function is prime() to check whether an input value is a prime. That is, i…
OR