コード例 #1
0
ファイル: 387.py プロジェクト: rainmayecho/applemunchers
def is_strong(n):
    d = digit_sum(n)
    if is_prime(n/d):
        return True
    return False
コード例 #2
0
ファイル: 80.py プロジェクト: rainmayecho/applemunchers
from Useful import digit_sum
from decimal import*

total = 0
iroot = [x for x in range(1,101) if x not in [1,4,9,16,25,36,49,64,81,100]]
for i in iroot:
    getcontext().prec = 102
    a = str(int((Decimal(i)**Decimal(.5))*Decimal(10**99)))[0:]
    total += digit_sum(int(a))

print total

コード例 #3
0
ファイル: 387.py プロジェクト: rainmayecho/applemunchers
def is_niven(n):
    d = digit_sum(n)
    if not n % d:
        return True
    return False