Beispiel #1
0
def are_digital_permutations (x, y, z):
	f = lambda x, y: ((x * 10) + y)
	a = digital_split(x)
	b = digital_split(y)
	c = digital_split(z)
	a.sort()
	b.sort()
	c.sort()
	A = reduce(f, a)
	B = reduce(f, b)
	C = reduce(f, c)
	return (A == B == C)
Beispiel #2
0
def is_circ_prime (n):
	if not is_prime(n):
		return False

	digits = digital_split(n)
	count = len(digits) - 1
	f = lambda x, y: ((x * 10) + y)

	for i in xrange(count):
		digits.append(digits.pop(0))
		m = reduce(f, digits)
		if not is_prime(m):
			return False

	return True
Beispiel #3
0
#!/usr/bin/env python

from math import factorial
from libeuler import digital_split

vals = []
for x in xrange(3, 100000):
	digits = digital_split(x)
	y = sum(map(factorial, digits))
	if x == y:
		vals += [x]

print sum(vals)