For your reference, in this chapter I’ll provide you with answer hints to some of the problems in the earlier chapters. For example, “For 16.” means “Hints for problems in Chapter 16.”
For 16. Pythagorean Triples
- 1.
Instead of using “c,” we may check whether (a2 + b2) is a perfect square number, which is taking a square root of it and validating if it is an integer value.
- 2.
Use the example code and check whether the resulting value of (a2 + b2) matches the form of “4n + 1”.