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:
Answers
Answered by
0
Answer:
looking for the same answer
Explanation:
Answered by
0
"If the value of n will be a perfect square" is the correct answer for the above question.
Explanation:
- The above code is in python language which checks the value which is entered by the user at the time of calling function is a perfect square or not.
- The function defined "f" is used to check the number x is a perfect square or not, if the number is a perfect square, then it returns true otherwise it returns false.
- To check the perfect square, the above function firstly counts the number of a factor of number x. then it checks that the total factor is equal to the (multiple of 2) +1 or not. if it is, it prints true otherwise false.
- It is because if a number is a perfect square then its total factor is equal to the (multiple of 2)+1.
Learn More:
- Python program : https://brainly.in/question/5558161
Similar questions