Most numbers have interesting properties, if you look hard enough and interpret “interesting” liberally. Let’s choose a number at random—300, say—and list some of its properties:
- It is divisible by the square of its largest prime factor.
- It is the area of a triangle with integer sides and integer area
- It is a folding point of the non-negative integers written in a hexagonal spiral (see below), as are 1, 2, 3, 4, 5, 7, 8, 10, 12, 14, 16, 19, 21, 24, etc.
A number that shares these properties is 108: (a) It is divisible by 9, or the square of its largest prime factor (3), (b) it is the area of a triangle with sides 15, 15, and 18, and (c) it is a folding point of the hexagon (it would be to the right of 75 in the hexagon below).
Write a function to determine whether a number has the three properties listed above.
Solution Stats
Problem Comments
2 Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers2
Suggested Problems
-
2 Solvers
More from this Author321
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
To pass the test cases, it seems that only conditions 1 and 3 need to be checked.
I've added some test cases. For example, the value in Test 3 (200) satisfies the first and third conditions but not the second.