You could use Euclid's algorithm: Euclid's algorithm for gcd states if a and b are positive integers and all qi and ri are non-negative integers then if a = q0b + r0 b = q1r0 + r1 r0 = q2r1 + r2 r1 = q3r2 + r3 ... rk-3 = qk-1rk-2 + rk-1 rk-2 = qkrk-1 + rk where if rk = 0 then gcd(a,b) = rk-1. 7n+4 = 1(5n+3) + (2n+1) 5n+3 = 2(2n+1) + (n+1) 2n+1 = 1(n+1) + 1 n+1 = 1(n+1) + 0 So gcd(7n+4,5n+3) = 1 Edwin