Largest int from concatenated ints: Difference between revisions

→‎{{header|REXX}}: corrected an error that was introduced into1st and 2nd programs that was overlooked 'til W.P. noticed it.
m (→‎{{header|REXX}}: added Version 4)
(→‎{{header|REXX}}: corrected an error that was introduced into1st and 2nd programs that was overlooked 'til W.P. noticed it.)
Line 1,965:
/* [↓] examine each number in the list*/
do while z\==''; index=1 /*keep examining the list until done.*/
big=isOK( word(z, 1) ); LB=length(big) /*assume that first integer is biggest.*/
/* [↓] check the rest of the integers.*/
do k=2 to words(z); #=isOK(word(z,k)) /*obtain an an integer from the list. */
L=max(LBlength(big), length(#) ) /*get the maximum length of the integer*/
if left(#, L, left(#, 1) ) <<= left(big, L, left(big, 1) ) then iterate
big=#; index=k /*we found a new biggie (and the index)*/
Line 2,008:
do while z\==''; p=uPow(1) /*keep examining the list until done.*/
if p\==0 then numeric digits p /*# has big exponent? Then adjust digs*/
big=isOK(y); index=1; LB=length(big) /*assume that first integer is biggest.*/
/* [↓] check the rest of the integers.*/
do k=2 to words(z); p=uPow(k) /*obtain an a number from the list. */
if p\==0 then numeric digits p + Lm +3 /*# has big exponent? Then adjust digs*/
#=isOK(y) /*obtain an an integer from the list. */
L=max(LBlength(big), length(#) ) /*get the maximum length of the integer*/
if left(#, L, left(#, 1) ) <<= left(big, L, left(big, 1) ) then iterate
big=#; index=k /*we found a new biggie (and the index)*/
Line 2,037:
{{out|output|text=&nbsp; when using the default (internal) integer lists:}}
<pre>
998764543431 max for: {1, 34, 3, 98, 9, 76, 45, 4}
6054854654 max for: {54, 546, 548, 60}
554454 max for: { 4, 45, 54, 5}
660000000000000000000000000000000000000000000000000000000000000000000000000000545454 660000000000000000000000000000000000000000000000000000000000000000000000000000554454 max for: { 4, 45, 54, 5, 6.6e77}
</pre>
 
===Alternate Version===
Inspired by the previous versions.