Problem 44788. Find the right number make the equation
Given positive integer number n, find the right positive integer number a, b , so that
(1) sqrt(a + n * b) is a positive integer number
(2) sqrt(hypot(a,b)) is a positive integer number
Note: the output must be char array!
Have fun!
Solution Stats
Problem Comments

9 Comments
Interesting. I've solved several more puzzles in the Community group after this one, but I still can't see your solution, Binbin. It's obviously much smaller than mine is, which is why I'm interested in figuring out how you did this.
@ James
To unlock all solutions of this problem, you must solve a newer problem than this one, not older problems.
@James, my solution is very simple, it is pure number.The challenge is from Fermat. Because the big number, it is hard to test. I want use Java's Big Integer, but it has no sqrt operation.
My program gives a wrong answer for n=1, but passes the tests due to insufficient precision. How big is the smallest solution for n=1?
@Tim, it is about 13 digitals. I want to submit another problem use char array as output and avoid to precision.
@James, @Tim, Because of precision, the problem have no meaning, so I have fix the test suits. The output must be char array. Thank you for your support.
I was using the method to parameterize Pythagorean triples (a,b,c) in terms of s and t. Since we're looking at c^4 instead of c^2 (to make sure that c itself is a perfect square), I can see why the numbers got quite large. My solution for n=2 was for larger numbers than my n=3 solution, although even my n=1 solution had the magnitude of a as 10^16 and b was 10^21. I didn't find anything on the order of 10^13.
@James, I think the following link will help you.
https://www.mathpages.com/home/kmath022/kmath022.htm
Very nice link, Binbin. That is was exactly what I was trying to do, only they didn't include the math error I made in my calculations. :)
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems

Find common elements in matrix rows
2628 Solvers

546 Solvers

116 Solvers

Is this triangle rightangled?
5676 Solvers

Numbers spiral diagonals (Part 1)
197 Solvers
More from this Author17
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!