[Codewars] Numbers that are a power of their sum of digits

Numbers that are a power of their sum of digits

  • Time :
  • Space :
1
2
3
def power_sumDigTerm(n):
result=[81,512,2401,4913,5832,17576,19683,234256,390625,614656,1679616,17210368,34012224,52521875,60466176,205962976,612220032,8303765625,10460353203,24794911296,27512614111,52523350144,68719476736,271818611107,1174711139837,2207984167552,6722988818432,20047612231936,72301961339136,248155780267521,3904305912313344,45848500718449031,81920000000000000,150094635296999121,13744803133596058624,19687440434072265625,53861511409489970176,73742412689492826049,179084769654285362176]
return result[n-1]
Author: Song Hayoung
Link: https://songhayoung.github.io/2023/06/02/PS/Codewars/numbers-that-are-a-power-of-their-sum-of-digits/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.