Ask Question
19 November, 06:33

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

+3
Answers (1)
  1. 19 November, 10:12
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers