Anonymous user
Munchausen numbers: Difference between revisions
m
→version 3: changed whitespace.
m (→version 2: added whitespace.) |
m (→version 3: changed whitespace.) |
||
Line 1,899:
It is about '''3''' times faster than REXX version 1.
<lang rexx>/*REXX program finds and displays Münchhausen numbers from one to a specified number (Z)*/
@.= 0;
parse arg z . /*obtain optional argument from the CL.*/
if z=='' | z=="," then z=
@is='is a Münchhausen number.'; do j=1 for z /* [↓] traipse through all the numbers*/
if isMunch(j) then say right(j, 11) @is
Line 1,910:
if $>ox then return 0 /*is sum too large?*/
do while x\=='' & $<=ox /*any more digits ?*/
parse var x _ +1 x; $= $ + @._
end /*while*/
return $==ox /*it is or it ain't*/</lang>
|