Anonymous user
Lychrel numbers: Difference between revisions
m
→{{Header|REXX}}: allowed the specification for the LIMIT, added/changed whitespace and comments.
(→{{header|Haskell}}: make it infinite list) |
m (→{{Header|REXX}}: allowed the specification for the LIMIT, added/changed whitespace and comments.) |
||
Line 2,953:
=={{Header|REXX}}==
<lang rexx>/*REXX program finds and displays Lychrel numbers, related numbers, and palindromes. */
if
T.= 0; @.= T.; #.=@.; w= length(high)
$= /*the list of Lychrel numbers. */
do j=1 for high; call Lychrel j
end /*j*/
p=;
do k=1 for high
if #.k then $= $ k
if T.k then R= R k
if T.k & k==reverse(k) then p= p k
end /*k*/
say 'Found in the range 1 to ' high " (limiting searches to " limit ' steps):'
say
say right( words($) , w) 'Lychrel numbers:' $
say right( words(R) - words($), w) 'Lychrel related numbers.'
say right( words(p) , w) 'Lychrel palindromes:' p
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
|