added fermat's primality test and euclid's algorithm