def count(x): c = 0 for j in range(1, x + 1): for l in range(j, x // j + 1): if x % (j*l) == 0 and gcd(l,j) == 1: c += 1 return c
def solve(): tStart = time.time() max = 1500001 m = 2 li = [0] * max for m in range(2, int(math.sqrt(max / 2))): for n in range(1, m): if (m + n) % 2 == 1 and help.gcd(m, n) == 1: Ls = 2 * m * n + 2 * m ** 2 L = Ls while L <= max: li[L] += 1 L += Ls print(len(list(filter(lambda i: li[i] == 1, range(1, max))))) print(len(list(filter(lambda i: li[i] == 0, range(1, max))))) print("Run Time = " + str(time.time() - tStart))
def calculate(N, expValue): numberOfSolutions = dict() for n in range(1, int(math.sqrt(N))+1): for m in range(n, int(math.sqrt(N // n))+1): if gcd(n,m) == 1: k = 1 c = k*(m**2+n**2) while c <= N: if c not in numberOfSolutions: numberOfSolutions[c] = 1 else: numberOfSolutions[c] += 1 k += 1 c = k*(m**2+n**2) #print(numberOfSolutions) result = [] for n in numberOfSolutions: if numberOfSolutions[n] == N // 4: result.append(n) return result