2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -1,21 +1,20 @@
|
|||
/*REXX program calculates the digital root and additive persisteance. */
|
||||
numeric digits 1000 /*lets handle biguns.*/
|
||||
say 'digital' /*part of the header.*/
|
||||
say ' root persistence' center('number',81) /* " " " " */
|
||||
say '═══════ ═══════════' center('' ,81,'═') /* " " " " */
|
||||
/*REXX program calculates and displays the digital root and additive persistence. */
|
||||
say 'digital' /*display the 1st line of the header.*/
|
||||
say " root persistence" center('number',77) /* " " 2nd " " " " */
|
||||
say "═══════ ═══════════" left('', 77, "═") /* " " 3rd " " " " */
|
||||
call digRoot 627615
|
||||
call digRoot 39390
|
||||
call digRoot 588225
|
||||
call digRoot 393900588225
|
||||
call digRoot 899999999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────DIGROOT subroutine──────────────────*/
|
||||
digRoot: procedure; parse arg x 1 ox /*get the num, save as original. */
|
||||
do pers=0 while length(x)\==1; r=0 /*keep summing until digRoot=1dig*/
|
||||
do j=1 for length(x) /*add each digit in the number. */
|
||||
r=r+substr(x,j,1) /*add a digit to the digital root*/
|
||||
end /*j*/
|
||||
x=r /*'new' num, it may be multi-dig.*/
|
||||
end /*pers*/
|
||||
say center(x,7) center(pers,11) ox /*show a nicely formatted line. */
|
||||
return
|
||||
call digRoot 89999999999999999999999999999999999999999999999999999999999999999999999999999
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
digRoot: procedure; parse arg x 1 ox /*get the number, also get another copy*/
|
||||
do pers=0 while length(x)\==1; $=0 /*keep summing until digRoot ≡ 1 digit.*/
|
||||
do j=1 for length(x) /*add each digit in the decimal number.*/
|
||||
$=$+substr(x,j,1) /*add a decimal digit to digital root. */
|
||||
end /*j*/
|
||||
x=$ /*a 'new' num, it may be multi-digit.*/
|
||||
end /*pers*/
|
||||
say center(x,7) center(pers,11) ox /*display a nicely formatted line. */
|
||||
return
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
∙
|
||||
∙
|
||||
∙
|
||||
/*──────────────────────────────────DIGROOT subroutine──────────────────*/
|
||||
digRoot: procedure; parse arg x 1 ox /*get the num, save as original. */
|
||||
do pers=0 while length(x)\==1; r=0 /*keep summing until digRoot=1dig*/
|
||||
do j=1 for length(x) /*add each digit in the number. */
|
||||
?=substr(x,j,1) /*pick off a char, maybe a dig ? */
|
||||
if datatype(?,'W') then r=r+? /*add a digit to the digital root*/
|
||||
end /*j*/
|
||||
x=r /*'new' num, it may be multi-dig.*/
|
||||
end /*pers*/
|
||||
say center(x,7) center(pers,11) ox /*show a nicely formatted line. */
|
||||
return
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
digRoot: procedure; parse arg x 1 ox /*get the number, also get another copy*/
|
||||
do pers=0 while length(x)\==1; $=0 /*keep summing until digRoot ≡ 1 digit.*/
|
||||
do j=1 for length(x) /*add each digit in the decimal number.*/
|
||||
?=substr(x, j, 1) /*pick off a character, maybe a digit ?*/
|
||||
if datatype(?, 'W') then $=$+? /*add a decimal digit to digital root. */
|
||||
end /*j*/
|
||||
x=$ /*a 'new' num, it may be multi-digit.*/
|
||||
end /*pers*/
|
||||
say center(x,7) center(pers,11) ox /*display a nicely formatted line. */
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue