Added coprime calculation