Munchausen numbers: Difference between revisions

Content added Content deleted
Line 107: Line 107:
=={{header|J}}==
=={{header|J}}==


Here, it would be useful to have a function which sums the powers of the digits of a number. Once we have that we can use that with an equality test to filter those integers:
Here, it would be useful to have a function which sums the powers of the digits of a number. Once we have that we can use it with an equality test to filter those integers:


<lang J> munch=: +/@(^~@(10&#.inv))
<lang J> munch=: +/@(^~@(10&#.inv))