Smallest numbers: Difference between revisions

m
→‎{{header|REXX}}: changed the title and title comment.
m (→‎{{header|Ring}}: flagged as missing the 50th number (N=50)..)
m (→‎{{header|REXX}}: changed the title and title comment.)
Line 5:
<br><br>
=={{header|REXX}}==
<lang rexx>/*REXX pgm finds the smallest positive integer K where kK**kK contains N, N < 51 */
numeric digits 200 /*ensure enough decimal digs for k**k */
parse arg hi cols . /*obtain optional argument from the CL.*/
Line 11:
if cols=='' | cols=="," then cols= 10 /* " " " " " " */
w= 6 /*width of a number in any column. */
@spiKK= ' smallest positive integer K where kK**kK contains N, N0 < ' N < ' commas(hi)
say ' N │'center(@spiKK, 5 + cols*(w+1) ) /*display the title of the output. */
say '─────┼'center("" , 5 + cols*(w+1), '─') /* " " separator " " " */
Line 25:
end /*j*/
 
if $\=='' then say center(idx, 5)"│"substr($, 2) /*possible display any residual output.*/
say '─────┴'center("" , 5 + cols*(w+1), '─') /* " " separator " " " */
exit 0 /*stick a fork in it, we're all done. */
Line 32:
{{out|output|text=&nbsp; when using the default inputs:}}
<pre>
N │ smallest positive integer K where kK**kK contains N, 0 ≤ N < 51
─────┼───────────────────────────────────────────────────────────────────────────
0 │ 9 1 3 5 2 4 4 3 7 9
Line 40:
40 │ 16 17 9 7 12 28 6 23 9 24
50 │ 23
─────┴───────────────────────────────────────────────────────────────────────────
</pre>