Ask Question

Find the number of ideal integers within the given segment [low, high] inclusive. An ideal number is a positive integer that has only 3 and 5 as prime divisors. An ideal number can be expressed in the form of 3^x*5^y, where x and y are non-negativeintegers

+5
Answers (1)
  1. 1 June, 07:56
    0
    low = 10 high = 50 count = 0 for i in range (low, high + 1) : if (i % 3 = = 0 and i % 5 = = 0) : count + = 1 print (count)

    Explanation:

    The solution code is written in Python.

    We can create low and high variables to store the lower bound and upper bound in the range (Line 1-2)

    Next create a counter variable, count (Line 3).

    Use a for loop to traverse through the number between lower bound and upper bound and check if the current number-i is divisible by 3 and by 5, increment the count by one.

    After the loop, print the count and we can get the number of ideal integers within the range (Line 8).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Find the number of ideal integers within the given segment [low, high] inclusive. An ideal number is a positive integer that has only 3 and ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers