Tech
PWC 393 Triangles and Primes
A couple of quick mathematical tasks for this week's challenges.
Task 1: Pythagoras Multiplied
Task Description
You are given a positive integer n . Find the number of all positive integer triplets ( a,b,c ) so that a 2 + b 2 = c 2 and a , b , and c are integers <= n .
Example 1: n=20 --> 12
(3,4,5),(4,3,5),(5,12,13),(6,8,10),(8,6,10),(8,15,17),(9,12,15),(12,5,13),(12,9,15),(12,16,20),(15,8,17),(16,12,20)
Example 2: n=7 -...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to