Again, suppose that n and r denote integer values where r > 0 and n ≥ 0. What are two "simple" values, say lowEnough and tooHigh, such that lowEnough ≤ ⌊n√r⌋⌊nr⌋ < tooHigh. Explain based on your answer to the previous question.

Suppose you would like to know ⌊47226−−−−−√5⌋⌊472265⌋. Explain how you could find ⌊47226−−−−−√5⌋⌊472265⌋ using a guess and verify method. Note: Explain your answer by relating this problem to the number guessing game described earlier. Think about what would be an appropriate question to use in place of "Is secret_number < guess_number?" and think about good choices for the starting values of lowEnough and tooHigh.

Respuesta :

Answer:

Answer explained

Explanation:

From the previous question we know that while searching for n^(1/r) we don't have to look for guesses less than 0 and greater than n. Because for less than 0 it will be an imaginary number and for rth root of a non negative number can never be greater than itself. Hence lowEnough = 0 and tooHigh = n.

we need to find 5th root of 47226. The computation of root is costlier than computing power of a number. Therefore, we will look for a number whose 5th power is 47226. lowEnough = 0 and tooHigh = 47226 + 1. Question that should be asked on each step would be "Is 5th power of number < 47227?" we will stop when we find a number whose 5th power is 47226.

This exercise can be solved with computer language code in python like this:

in the attached image.

So making it easier we find the code in python like:

lowEnough = input("What is your Low number?")

user_age = int(lowEnough)

as_string = str(user_age)

print("Your number is: " + as_string)

tooHigh = input("What is your high number?")

user_age2 = int(tooHigh)

as_string2 = str(user_age2)

print("Your number is: " + as_string2)

See more about python at brainly.com/question/26104476

Ver imagen lhmarianateixeira
ACCESS MORE