This commit is contained in:
Ingy döt Net 2013-04-10 16:57:12 -07:00
parent 518da4a923
commit 764da6cbbb
6144 changed files with 83610 additions and 11 deletions

View file

@ -0,0 +1,10 @@
def droot (n):
x = [n]
while x[-1] > 10:
x.append(sum(int(dig) for dig in str(x[-1])))
return len(x) - 1, x[-1]
for n in [627615, 39390, 588225, 393900588225]:
a, d = droot (n)
print "%12i has additive persistance %2i and digital root of %i" % (
n, a, d)