# (Solved) : Def Sumoftwosquares N Positive Integers Expressed Sum Two Integers Squares Positive Intege Q42636800 . . .

want a python code.

def sum_of_two_squares (n) Some positive integers can be expressed as sum of two integers that each are squares of positive integers greater than zero. For example, 74 49 25, where 49 72 and 25 52. This function should find and return a tuple of two positive integers greater than zero whose squares together add up to n, or return None if the parameter n cannot be broken down into a sum of two squares. To facilitate the automated testing, the returned tuple must give the larger of its two numbers first Furthermore, if some integer can be broken down to sum of squares in several different ways, return the way that maximizes the larger number. For example, the number 85 allows two such representations 72+62 and 92 +22, of which this function must therefore return (9, 2). The easiest way to solve this problem would be looping through all integer values of a that satisfy a*a< n, and for each such a, check whether the rest of the number n-a*a is also some square. Once this part is working, various ways exist to speed up the step of quickly determining whether some number is a square, and if so, which particular integer it is the square of. Expected result n 1 None (1, 1) 2 (7, 1) (2, 2) 50 Show transcribed image text def sum_of_two_squares (n) Some positive integers can be expressed as sum of two integers that each are squares of positive integers greater than zero. For example, 74 49 25, where 49 72 and 25 52. This function should find and return a tuple of two positive integers greater than zero whose squares together add up to n, or return None if the parameter n cannot be broken down into a sum of two squares. To facilitate the automated testing, the returned tuple must give the larger of its two numbers first Furthermore, if some integer can be broken down to sum of squares in several different ways, return the way that maximizes the larger number. For example, the number 85 allows two such representations 72+62 and 92 +22, of which this function must therefore return (9, 2). The easiest way to solve this problem would be looping through all integer values of a that satisfy a*a

Answer to def sum_of_two_squares (n) Some positive integers can be expressed as sum of two integers that each are squares of posit…

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.