Anonymous user
Largest int from concatenated ints: Difference between revisions
Largest int from concatenated ints (view source)
Revision as of 22:39, 27 January 2018
, 6 years ago→{{header|REXX}}: corrected an error that was introduced into1st and 2nd programs that was overlooked 'til W.P. noticed it.
Walterpachl (talk | contribs) 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) )
/* [↓] 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(
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
/* [↓] 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(
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= when using the default (internal) integer lists:}}
<pre>
6054854654 max for: {54, 546, 548, 60}
554454 max for: { 4, 45, 54, 5}
</pre>
===Alternate Version===
Inspired by the previous versions.
|