Example #1
0
def d(n):
	factors = factor.get_factors(n)
	am_nums = []
	for pair in factors:
		if n in pair:
			am_nums.append(1)
		else:
			am_nums += pair
	return sum(am_nums)
Example #2
0
def is_abundant(n):
    if n not in memo_a:
        factors = factor.get_factors(n)
        fac_sum = 0
        for pair in factors:
            if n in pair:
                fac_sum += 1
            else:
                fac_sum += pair[0]
                if pair[0] != pair[1]:
                    fac_sum += pair[1]
        memo_a[n] = fac_sum > n
    return memo_a[n]
Example #3
0
def is_abundant(n):
	if n not in memo_a:
		factors = factor.get_factors(n)
		fac_sum = 0
		for pair in factors:
			if n in pair:
				fac_sum += 1
			else:
				fac_sum += pair[0]
				if pair[0] != pair[1]:
					fac_sum += pair[1]
		memo_a[n] = fac_sum > n
	return memo_a[n]
Example #4
0
#!/usr/bin/env pypy

from factor import get_factors

primes_found = 0
prime_to_get = 10001
current_prime = 1

while primes_found < prime_to_get - 2:
    current_prime += 1
    if len(get_factors(current_prime)) == 1:
        primes_found += 1

print(current_prime)
Example #5
0
def is_prime(n):
    return n >= 0 and len(factor.get_factors(n)) == 1
Example #6
0
#!/usr/bin/env pypy

from factor import get_factors

counter = 1
accumulator = 0
max_factors = 0

while max_factors <= 250:
    accumulator += counter
    counter += 1
    factors = len(get_factors(accumulator))
    if factors > max_factors:
        max_factors = factors

print(accumulator)
Example #7
0
def is_prime(n):
	return n >= 0 and len(factor.get_factors(n)) == 1
Example #8
0
#!/usr/bin/env pypy

from factor import get_factors

bound = 2000000

running_sum = 0

for i in xrange(2, bound):
	if len(get_factors(i)) == 1:
		running_sum += i
	if not (i%20000):
		print(i)
		
print(running_sum)
Example #9
0
#!/usr/bin/env pypy

from factor import get_factors

primes_found = 0
prime_to_get = 10001
current_prime = 1

while primes_found < prime_to_get-2:
	current_prime += 1
	if len(get_factors(current_prime)) == 1:
		primes_found += 1

print(current_prime)