Factorions: Difference between revisions

m (Updated description and link for Fōrmulæ solution)
Line 1,079:
<lang Ring>
load "stdlib.ring"
see "working..." + nl
 
for n = 13 to 100000
facDigits = 0[]
numStrsumFact = string(n)0
for mstrn = 1 to lenstring(numStrn)
for m = 1 numto = numberlen(numStr[m]strn)
facfact = fac + factorial(numnumber(strn[m]))
sumFact += fact
add(Digits,fact)
next
if nsumFact = fac n
seefor "Factorion:ind "= +1 nto + nllen(strn)-1
see "" + strn[ind] + "! + "
next
see "" + strn[ind] + "! = "
for p = 1 to len(Digits) - 1
see "" + Digits[p] + " + "
next
factLast = Digits[p]
see "" + factLast + " = " + n + nl
ok
next
 
see "done..." + nl
</lang>
<pre>
working...
Factorion: 1
1! + 4! + 5! = 1 + 24 + 120 = 145
Factorion: 2
4! + 0! + 5! + 8! + 5! = 24 + 1 + 120 + 40320 + 120 = 40585
Factorion: 145
done...
Factorion: 40585
</pre>
 
=={{header|Ruby}}==
<lang ruby>
2,468

edits