Mar-20-2017, 06:28 AM
I'm new to this stuff so it's nothing too impressive
import random import math coprime = 0 cofactor = 0 sets = 0 while(sets<10000): random1 = random.randint(1, 1000) random2 = random.randint(1, 1000) i = 2 while(True): if i==random1 or i==random2: coprime = coprime + 1 break elif random1%i==0 and random2%i==0: cofactor = cofactor + 1 i = i + 1 sets = sets + 1(it's still running btw, any help with improving efficiency would be greatly appreciated but I'm ok with leaving this to run)