コード例 #1
0
def problem187():
	GOAL = 10**8
	m = rwh_primes2(GOAL)
	primes = orderedlist(m)
	count = 0
	for p in m:
		if GOAL//p <= 1:
			break
		count += len(primes[p: GOAL//p])
	return count
コード例 #2
0
def problem179a():
	GOAL = 10**5
	#checker = primes(save=True,initial=False)
	primes = rwh_primes2(GOAL//2)
	previous = 0
	# counting 2
	count = 1
	for n in range(3,GOAL):
		# If it n+1 is prime, we can skip this number
		if isPrime(n):
			sig = 2
		else:
			sig = sigma(n,primes)
		if sig == previous:
			count += 1
		previous = sig
	return count