Exemplo n.º 1
0
def problem124():
	checker = primes(save=True,initial=False)
	unsorted = [(1,1)]
	for c in generateFactors(100000,checker):
		unsorted.append((radFromFactors(c),product(c)))
	# Python already sorts list of tuples as first index first, second index in case of ties
	# so we use this by adding the elements rad(n) first
	unsorted.sort()
	return unsorted[10000-1][1]
Exemplo n.º 2
0
def problem87():
	checker = primes(save=True,initial=False)
	seen = []
	GOAL  = 5*10**7
	for c in checker[1:(GOAL - 2**3 - 2**2)**(1/4)]:
		for b in checker[1:(GOAL - c**4 - 2)**(1/3)]:
			for a in checker[1:(GOAL - c**4 - b**3)**(1/2)]:
				seen.append(a**2 + b**3 + c**4)
					#print(a**2 + b**3 + c**4)
	return len(set(seen))
Exemplo n.º 3
0
def problem104():
	c = primes()
	memo={0:0, 1:1}
	for k, F in enumerate(genLast10Fib()):
		if isPandigital(F):
			a = top_digits(k+1)
			if isPandigital(a):
				return k + 1
		if k+2 > 329468:
			break
Exemplo n.º 4
0
def problem179():
	GOAL = 10**7
	checker = primes(save=True,initial=False)
	#primes = rwh_primes2(GOAL//2)
	previous = 0
	# counting 2
	count = 0
	d = {1:1}
	for n in generateFactors(GOAL+1, checker):
		d[product(n)] = sigmaFromFactors(n)
	for n in range(1,GOAL):
		if d[n] == d[n+1]: count+=1
	return count
Exemplo n.º 5
0
def problem123():
	checker = primes(save=True,initial=False)
	for n, p in enumerate(checker[0:10**6]):
		#print(n+1,p)
		if (n+1) % 2 == 1 and 2*(n+1)*p > 10**10:
			return n + 1
Exemplo n.º 6
0
def problem233():
	checker = primes(save=True, initial=False)
	checker.cleanup()

	print(numberOfSolutions(checker.factors(2*10000)))
	print(checker.factors(10000))