def f(n):
s=0
for i in range(1,n+1):
if n%i == 0:
s = s+1
return(s%2 == 1)
The function f(n) given above returns True for a positive number n if and only if:
n is an odd number.
n is a prime number.
n is a composite number.
n is a perfect square.
1
Expert's answer
2019-08-08T09:56:07-0400
The code counts number of divisors of given N, and returns true if it's odd.
Let D be a divisor of N, so N/D is also a divisor. So every divisor has its own pair. But if the number of them is odd, D == N/D, and N is a perfect square
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment