Computer Science, asked by harinisudhakar8, 1 year ago

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.

Answers

Answered by Anonymous
4

Answer:

In the history of Europe, the Middle Ages (or medieval period) lasted from the 5th to the 15th century. It began with the fall of the Western Roman Empire and merged into the Renaissance and the Age of Discover Middle Ages is the middle period of the three traditional divisions of Western history: classical antiquity, the medieval period, and the modern period. The medieval period is itself subdivided into the Early, High, and Late Middle Ages.

Population decline, counterurbanisation, collapse of centralized authority, invasions, and mass migrations of tribes, which had begun in Late Antiquity, continued in the Early Middle Ages. The large-scale movements of the Migration Period, including various Germanic peoples, formed new kingdoms in what remained of the Western Roman Empire. In the 7th century, North Africa and the Middle East—once part of the Byzantine Empire—came under the rule of the Umayyad Caliphate, an Islamic empire, after conquest by Muhammad's successors. Although there were substantial changes in society and political structures, the break with classical antiquity was not complete. The still-sizeable Byzantine Empire, Rome's direct continuation, survived in the Eastern Mediterranean and remained a major power. The empire's law code, the Corpus Juris Civilis or "Code of Justinian", was rediscovered in Northern Italy in 1070 and became widely admired later in the Middle Ages. In the West, most kingdoms incorporated the few extant Roman institutions.

Answered by AskewTronics
0

The function f(n) defined in the question returns true, if n is a prefect square.

Explanation:

  • The above code firstly finds the number of a factor of any number.
  • Then it checks that the total factor is a (multiple of 2)+1 or not.
  • If it is a (multiple of 2)+1, then it will be a perfect square.
  • for example, if a user gives input 5, then its factor is 2 but for the 25, the total factor is 5.
  • If the user wants to check any number is a perfect square or not, then he can check by the above code.

Learn More:

  • Python: https://brainly.in/question/14689905

Similar questions