Munchausen numbers: Difference between revisions

Content added Content deleted
(add REXX)
Line 188: Line 188:


<lang J> munch=: +/@(^~@(10&#.inv))
<lang J> munch=: +/@(^~@(10&#.inv))
(#~ ] = munch"0) 1+i.5000
1 3435</lang>

Note that [[wp:Munchausen_number|wikipedia]] claims that 0=0^0 in the context of Munchausen numbers. It's not clear why this should be (1 is the multiplicative identity and if you do not multiply it by zero it should still be 1), but it's easy enough to implement. Note also that this does not change the result for this task:

<lang J> munch=: +/@((**^~)@(10&#.inv))
(#~ ] = munch"0) 1+i.5000
(#~ ] = munch"0) 1+i.5000
1 3435</lang>
1 3435</lang>