#Project Euler Problem 182 #http://blog.dreamshire.com/project-euler-182-solution/ from projecteuler import gcd p, q, s, e = 1009, 3643, 0, 3 phi = (p - 1) * (q - 1) while (e < phi): if gcd(e, phi) == 1 and gcd(e - 1, q - 1) == 2 and gcd(e - 1, p - 1) == 2: s += e e += 4 print "Project Euler 182 Solution =", s
#Project Euler Problem 182 #http://blog.dreamshire.com/project-euler-182-solution/ from projecteuler import gcd p, q, s, e = 1009, 3643, 0, 3 phi = (p-1) * (q-1) while (e < phi): if gcd(e, phi)==1 and gcd(e-1, q-1)==2 and gcd(e-1, p-1)==2: s += e e += 4 print "Project Euler 182 Solution =", s
#http://blog.dreamshire.com/project-euler-91-solution/ from projecteuler import gcd n = 50 t = 0 for x in range(1, n + 1): for y in range(1, n): m = gcd(x, y) t += min(x * m / y, m * (n - y) / x) print 'Project Euler 91 Solution =', t * 2 + n * n * 3
#http://blog.dreamshire.com/project-euler-91-solution/ from projecteuler import gcd n = 50 t = 0 for x in range(1, n+1): for y in range(1, n): m = gcd(x, y) t += min(x*m/y, m*(n-y)/x) print 'Project Euler 91 Solution =', t*2 + n*n*3