#  File:       pythagorean_triplet.py
#  Purpose:    A Pythagorean triplet program
#  Programmer: Amal Shehu
#  Course:     Exercism
#  Date:       Thursday 29 September 2016, 04:30 PM

from fractions import gcd


def triplets_in_range(min_value, max_value):
    triple = set()
    for a in range(min_value, max_value + 1):
        for b in range(a, max_value + 1):
            for c in range(b, max_value + 1):
                if a**2 + b**2 == c**2:
                    triple.update([(a, b, c)])
    return triple


def is_coprime(a, b):
    return gcd(a, b) == 1

    

@@ -188,28 +188,80 @@
 rom 
-fractions import gcd
+math import sqrt%0Afrom fractions import gcd%0Afrom itertools import count%0A%0A
 %0A%0A%0Ad
@@ -572,54 +572,507 @@
 def 
-is_coprime(a, b):%0A    return gcd(a, b) == 1%0A%0A    
+primitive_triplets(b):%0A    trips = set()%0A    for x, y, z in trip(b):%0A        if gcd(x, y) == gcd(y, z) == 1:%0A            trips.add((x, y, z))%0A    return trips%0A%0Adef trip(b):%0A    if b %25 4:%0A        raise ValueError('Invalid Input')%0A    max_num = int(sqrt((b - 1) / 2))%0A    for n in range(1, max_num + 1):%0A        m, redr = divmod(b / 2, n)%0A        if redr == 0:%0A            yield(tuple(sorted((m*m - n*n, b, m*m + n*n))))%0A%0Adef is_triplet(triplet):%0A    a, b, c = sorted(triplet)%0A    return a*a + b*b == c*c
 %0A

Add primitive_triplets function