Digit fifth powers
Digit fifth powers is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
- Task
Task desciption is taken from Project Eulet(https://projecteuler.net/problem=30)
Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.
Ring
<lang ring> see "working..." + nl
sumEnd = 0 sumList = [] limitStart = 10000 limitEnd = 99999
for n = limitStart to limitEnd
sum = 0 nStr = string(n) for m = 1 to len(nStr) sum = sum + pow(number(nStr[m]),5) next if sum = n add(sumList,n) sumEnd += n ok
next
see "The sum of all the numbers that can be written as the sum of fifth powers of their digits:" + nl for n = 1 to len(sumList)-1
see "" + sumList[n] + " + "
next see "" + sumList[n] + " = " + sumEnd + nl see "done..." + nl </lang>
- Output:
working... The sum of all the numbers that can be written as the sum of fifth powers of their digits: 54748 + 92727 + 93084 = 240559 done...