2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,22 +1,22 @@
/*REXX pgm computes/shows the left factorial (or width) of N (or range).*/
parse arg bot top inc . /*obtain optional args from C.L. */
if bot=='' then bot=1 /*BOT defined? Then use default.*/
td= bot<0 /*if BOT < 0, only show # digs.*/
bot=abs(bot) /*use the |bot| for the DO loop.*/
if top=='' then top=bot /* " " top " " " " */
if inc='' then inc=1 /* " " inc " " " " */
@='left ! of ' /*a literal used in the display. */
w=length(H) /*width of largest number request*/
do j=bot to top by inc /*traipse through #'s requested.*/
if td then say @ right(j,w) " ───► " length(L!(j)) ' digits'
else say @ right(j,w) " ───► " L!(j)
end /*j*/ /* [↑] show either L! or #digits*/
exit /*stick a fork in it, we're done.*/
/*──────────────────────────────────L! subroutine───────────────────────*/
L!: procedure; parse arg x .; if x<3 then return x; s=4 /*shortcuts.*/
!=2; do f=3 to x-1 /*compute L! for all numbers───►X*/
!=!*f /*compute intermediate factorial.*/
if pos(.,!)\==0 then numeric digits digits()*1.5%1 /*bump digs.*/
s=s+! /*add the factorial ───► L! sum.*/
end /*f*/ /* [↑] handles gi-hugeic numbers*/
return s /*return the sum (L!) to invoker.*/
/*REXX program computes/display the left factorial (or its width) of N (or range). */
parse arg bot top inc . /*obtain optional argumenst from the CL*/
if bot=='' | bot=="," then bot= 1 /*Not specified: Then use the default.*/
if top=='' | top=="," then top=bot /* " " " " " " */
if inc='' | inc=="," then inc= 1 /* " " " " " " */
tellDigs= (bot<0) /*if BOT < 0, only show # of digits. */
bot=abs(bot) /*use the │bot│ for the DO loop. */
@= 'left ! of ' /*a handy literal used in the display. */
w=length(H) /*width of the largest number request. */
do j=bot to top by inc /*traipse through the numbers requested*/
if tellDigs then say @ right(j,w) " ───► " length(L!(j)) ' digits'
else say @ right(j,w) " ───► " L!(j)
end /*j*/ /* [↑] show either L! or # of digits*/
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
L!: procedure; parse arg x .; if x<3 then return x; s=4 /*some shortcuts. */
!=2; do f=3 to x-1 /*compute L! for all numbers ─── ► X.*/
!=!*f /*compute intermediate factorial. */
if pos(.,!)\==0 then numeric digits digits()*1.5%1 /*bump decimal digits.*/
s=s+! /*add the factorial ───► L! sum. */
end /*f*/ /* [↑] handles gihugeic numbers. */
return s /*return the sum (L!) to the invoker.*/