Narcissistic decimal number: Difference between revisions

Content added Content deleted
(→‎JS Reduced search: Extended domain of digitList to zero)
(→‎Functional Python: Simplified predicate, extended domain of digitList to 0.)
Line 3,335: Line 3,335:
x for x in digitPowerSums(n)
x for x in digitPowerSums(n)
if isDaffodil(n)(x)
if isDaffodil(n)(x)
] if 0 < n else [0]
]




Line 3,374: Line 3,374:
ds = digitList(n)
ds = digitList(n)
return e == len(ds) and n == powerSum(e)(ds)
return e == len(ds) and n == powerSum(e)(ds)
return lambda n: True if 1 == e and n == 0 else go(n)
return lambda n: go(n)




Line 3,415: Line 3,415:
list of single-digit integers.
list of single-digit integers.
'''
'''
def go(x):
return digitList(n // 10) + [n % 10] if n else []
return go(x // 10) + [x % 10] if x else []
return go(n) if n else [0]