Factorions: Difference between revisions

m (→‎{{header|Pascal}}: added TIO.RUN until base 17. base 2still wrong)
Line 1,350:
 
The factorions for base 12 are: 1 2
</pre>
 
=={{header|Ring}}==
{{improve|Ring|Task requires bases 9 through 12. Example only shows base 10.}}
<lang Ring>
load "stdlib.ring"
see "working..." + nl
 
for n = 1 to 100000
Digits = []
sumFact = 0
strn = string(n)
for m = 1 to len(strn)
fact = factorial(number(strn[m]))
sumFact += fact
add(Digits,fact)
next
if sumFact = n
for ind = 1 to len(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...
1! = 1 = 1
2! = 2 = 2
1! + 4! + 5! = 1 + 24 + 120 = 145
4! + 0! + 5! + 8! + 5! = 24 + 1 + 120 + 40320 + 120 = 40585
done...
</pre>
 
2,468

edits