Smallest square that begins with n: Difference between revisions

m
→‎{{header|REXX}}: simplified some code.
m (→‎{{header|REXX}}: changed program to not show the 50th number.)
m (→‎{{header|REXX}}: simplified some code.)
Line 163:
 
Also, the output display was generalized so that if a larger number is wider than expected,   it won't be truncated.
<lang rexx>/*REXX program finds and displays (positivedecimal integers) squares that begin with N. */
numeric digits 20 /*ensure that large numbers can be used*/
parse arg n cols . /*get optional number of primes to find*/
Line 178:
end /*k*/
#= # + 1 /*bump the count of numbers found. */
c= commas(k * k); L= length(c) /*calculate K**2 (with commas) and L */
$= $ right( c, max(w, Llength(c) ) /*add square to $ list, allow for big N*/
if #//cols\==0 then iterate /*have we populated a line of output? */
say center(idx, 7)'│' substr($, 2); $= /*display what we have so far (cols). */