コード例 #1
0
def problem130():
	count = 0
	n = 1
	total = 0
	while count < 25:
		if gcd(n,10) == 1 and not isPrime(n) and (n-1)%A(n) == 0:
			count += 1
			total += n
		n+=1
	return total
コード例 #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