Jump to content

Tau number: Difference between revisions

m
→‎{{header|REXX}}: added/changed comments, added a foot title.
m (→‎{{header|REXX}}: added/changed comments, added a foot title.)
Line 1,613:
=={{header|REXX}}==
<lang rexx>/*REXX pgm displays N tau numbers, an integer divisible by the # of its divisors). */
parse arg n cols . /*obtain optional argument from the CL.*/
if n=='' | n=="," then n= 100 n= 100 /*Not specified? Then use the default.*/
sayif cols==''The first| 'cols=="," then ncols= 10 " tau numbers:"; say /*displayNot whatspecified? the outputThen beinguse shown.the default.*/
w= max(78, length(n) ) /*W: used to align 1st output column. */
say@tau= '─index─ the first ' centercommas(n) " tau numbers ", 70, '─') /*display athe title forof the tau numbers table. */
w= max(7, length(n) ) /*W: used to align 1st output column. */
say ' index │'center(@tau, 1 + cols*(w+1) ) /*display the title of the output table*/
$= /*$: the output list, shown ten/line. */
say '───────┼'center("" , 1 + cols*(w+1), '─') /* " " header " " #= 0 /*#: the" count of tau numbers so" far. */
$idx= 1; #= 0; $= /*idx: line; #: tau numbers; /*$: the output list, shown ten/line.#s */
do j=1 until #==n /*search for N tau numbers */
if j//tau(j) \==0 then iterate /*Is this a tau number? No, then skip.*/
#= # + 1 /*bump the count of tau numbers found. */
$= $ || right( commas(j), w) /*add a tau number to the output list. */
if #//10cols\==0 then iterate /*Not a multiple of 10cols? Don't displayshow. */
say rightcenter(commas(#-9)idx, w-37)' ' substr($, 2) /*display partial list to the terminal.*/
$idx= idx + cols; $= /*startbump withidx aby blanknumber lineof forcols; nextnullify line$*/
end /*j*/
 
if $\=='' then say center(#//10idx, w-37)"│" substr($, 2) /*anypossible residualsdisplay tauresidual #s left to display?output.*/
say '───────┴'center("" , 1 + cols*(w+1), '─')
exit 0 /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
Line 1,650 ⟶ 1,652:
{{out|output|text=&nbsp; when using the default input:}}
<pre>
The index │ the first 100 tau numbers:
───────┼───────────────────────────────────────────────────────────────────────────────────────────
 
1 │ 1 2 8 9 12 18 24 36 40 56
─index─ ──────────────────────────── tau numbers ─────────────────────────────
11 1 1 60 2 72 8 80 9 84 12 18 88 24 96 36 104 40 56108 128 132
1121 60 136 72 152 80 156 84 88180 96 184 104 204 108 128 225 132 228 232 240
2131 136 248 152 156 252 180 276 184 204 288 225 296 228 232 328 240 344 348 360 372
3141 248 376 252 276 384 288 396 296 328 424 344 441 348 360 444 372 448 450 468 472
4151 376 480 384 396 488 424 492 441 444 504 448 516 450 468 536 472 560 564 568 584
5161 480 600 488 492 612 504 625 516 536 632 560 636 564 568 640 584 664 672 684 708
6171 600 712 612 625 720 632 732 636 640 776 664 792 672 684 804 708 808 824 828 852
7181 712 856 720 732 864 776 872 792 804 876 808 880 824 828 882 852 896 904 936 948
8191 856 972 864 872 996 876 1,016 880 1,040 882 1,044 896 1,048 904 1,056 936 1,068 948 1,089 1,096
───────┴───────────────────────────────────────────────────────────────────────────────────────────
91 972 996 1,016 1,040 1,044 1,048 1,056 1,068 1,089 1,096
</pre>
 
Cookies help us deliver our services. By using our services, you agree to our use of cookies.