Computer-generated and assisted proofs occupy a niche in Computer Science. The first proof of the four-color problem was completed with the help of a computer program, and current efforts have succeeded in verification at the processor level.
This problem concerns computing values related to part of Fermat's Last Theorem, namely, that there are no integer solutions to a^n + b^n = c^n for n > 2.
Given a positive integer , you are to write a program that finds two values related to solutions of x^2 + y^2 = z^2, where , , and are positive integers less than or equal to . Find the number of triples (x, y, z) such that x < y < z, and , , are relatively prime (no common divisor greater than ). Also, compute the number of values 0 < p \leq N such that does not appear in any such triple (not just relatively prime triples).
The input consists of a sequence of positive integers, one per line. Each integer is at most . Input ends at end-of-file.
For each in the input, output two integers separated by a space: the number of relatively prime triples (x, y, z) (with each component at most ), and the number of positive integers at most that are not a component of any triple of positive integers at most . Output each pair on a separate line.
Ejemplo 1