This problem is related to 1283, Points on a Sphere. In this case, instead of a sphere, you have a circle. Given a radius R, calculate the number of points on the circumference of the circle that have two integer coordinates. For a circle of radius 5, you would have 12 points:
- (0, 5) and (0, -5)
- (5, 0) and (-5, 0)
- (4, 3) and (4, -3)
- (-4, 3) and (-4, -3)
- (3, 4) and (3, -4)
- (-3, 4) and (-3, -4)
Some radii are quite large, so watch out. Good luck!
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers25
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6691 Solvers
-
Project Euler: Problem 4, Palindromic numbers
1266 Solvers
-
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
252 Solvers
-
Unique values without using UNIQUE function
444 Solvers
-
The Answer to Life, the Universe, and Everything
578 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
Great problem! Learned a bunch from others solutions as well.
In the problem statement, I think you meant '3' and '4', rather than '1' and '2', in the respective +/- combinations.
Thanks for catching my stupidity on that one, HH. It's fixed now.
The tip for this question is the sum of squares function, which I use in my solution. There are many possible solutions to this problem, but the huge circle radii limit what we can employ, so be careful.