Anonymous user
Lychrel numbers: Difference between revisions
m
→{{Header|REXX}}: changed whitespace and indentations.
(Add Swift) |
m (→{{Header|REXX}}: changed whitespace and indentations.) |
||
Line 2,855:
numeric digits 250 /*ensure enough decimal digits for adds*/
parse arg high . /*obtain optional argument from the CL.*/
if high='' | high=="," then high=
limit=
T.= 0; @.=
$= /*the list of Lychrel numbers. */
do j=1 for high;
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
say
say right(words($) , w) 'Lychrel numbers:' $
Line 2,876:
/*──────────────────────────────────────────────────────────────────────────────────────*/
Lychrel: procedure expose limit @. #. T.; parse arg x 1 z /*set X and Z to argument 1.*/
rels=
#.x=
T.x= 1;
return</lang>
{{out|output|text= when using the default inputs:}}
<pre>
Found in the range 1 to 10000 (limiting searches to 1000 steps):
5 Lychrel numbers: 196 879 1997 7059 9999
|