Problem 60958. Determine whether a number is a seesaw number
Cody Problem 60957 dealt with balanced primes. In that case, balance was measured in terms of the average of primes around a given prime.
This problem involves a different sense of balance. Consider the input number x to be at the fulcrum of a massless seesaw (or teeter-totter). Then place the next m smaller numbers to the left and the next n larger numbers to the right. Each number creates a torque about the fulcrum equal to the product of the number and its distance from the fulcrum. In the example below with 14 at the fulcrum, the number 10 creates a torque of 140 units about the fulcrum. The number x is a seesaw number if m and n can be found to balance the seesaw; that is, the torque on the left balances the torque on the right.
For example, 14 is a seesaw number—as shown below—because the numbers 4 through 13 create a total torque of 385 units on the left and the numbers 15 through 20 create an opposing torque of 385 units on the right.
Write a function to determine whether the input number is a seesaw number.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers4
Suggested Problems
More from this Author310
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!