Munchausen numbers: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 955: | Line 955: | ||
return $==ox /*it is or it ain't*/</lang> |
return $==ox /*it is or it ain't*/</lang> |
||
'''output''' is the same as the 2<sup>nd</sup> REXX version. <br><br> |
'''output''' is the same as the 2<sup>nd</sup> REXX version. <br><br> |
||
=={{header|Ring}}== |
|||
<lang ring> |
|||
# Project : Munchausen numbers |
|||
# Date : 2017/09/30 |
|||
# Author : Gal Zsolt (~ CalmoSoft ~) |
|||
# Email : <calmosoft@gmail.com> |
|||
limit = 5000 |
|||
for n=1 to limit |
|||
sum = 0 |
|||
msum = string(n) |
|||
for m=1 to len(msum) |
|||
ms = number(msum[m]) |
|||
sum = sum + pow(ms, ms) |
|||
next |
|||
if sum = n |
|||
see n + nl |
|||
ok |
|||
next |
|||
</lang> |
|||
Output: |
|||
<pre> |
|||
1 |
|||
3435 |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |