Showing posts with label Uva- Primitive Pythagorean Triples Uva Problems & Solution. Show all posts
Showing posts with label Uva- Primitive Pythagorean Triples Uva Problems & Solution. Show all posts

Uva 106 - Fermat vs. Pythagoras

Oct 2, 2015

Problem: 106 - Fermat vs. Pythagoras
Problem Definition:
  1. Fermat's Last Theorem: that there are no integer solutions of tex2html_wrap_inline29 for n >2.
  2. Given a positive integer N, you are to write a program that computes two quantities regarding the solution of
    displaymath22
    where x, y, and z are constrained to be positive integers less than or equal to N. You are to compute the number of triples (x,y,z) such that x<y< z, and they are relatively prime, i.e., have no common divisor larger than 1.
  3. You are also to compute the number of values tex2html_wrap_inline51 such that p is not part of any triple (not just relatively prime triples).
You have to focus on 2 and 3.