Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
|
|
@ -1,19 +1,30 @@
|
|||
/*REXX program calculates and displays the digital root and additive persistence. */
|
||||
say 'digital additive' /*display the 1st line of the header.*/
|
||||
say " root persistence" center('number',77) /* " " 2nd " " " " */
|
||||
say "═══════ ═══════════" left('', 77, "═") /* " " 3rd " " " " */
|
||||
say digRoot( 627615)
|
||||
say digRoot( 39390)
|
||||
say digRoot( 588225)
|
||||
say digRoot( 393900588225)
|
||||
say digRoot(89999999999999999999999999999999999999999999999999999999999999999999999999999)
|
||||
say "═══════ ═══════════" left('', 77, "═") /*display the foot separator. */
|
||||
exit 0 /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
digRoot: procedure; parse arg x 1 z; L= length(x) /*get a number & also another copy*/
|
||||
do pers=1 until L==1; $= left(x, 1) /*sum until digRoot ≡ one digit. */
|
||||
do j=2 for L-1; $= $+substr(x,j,1) /*add digits in the decimal number*/
|
||||
end /*j*/
|
||||
x= $; L= length(x) /*a new num, it may be multi─digit*/
|
||||
end /*pers*/
|
||||
return center(x, 7) center(pers, 11) z /*return a nicely formatted line. */
|
||||
-- 8 May 2025
|
||||
include Settings
|
||||
|
||||
say 'DIGITAL ROOT'
|
||||
say version
|
||||
say
|
||||
numeric digits 30
|
||||
say Show(0)
|
||||
say Show(9)
|
||||
say Show(10)
|
||||
say Show(19)
|
||||
say Show(199)
|
||||
say Show(679)
|
||||
say Show(6788)
|
||||
say Show(39390)
|
||||
say Show(588225)
|
||||
say Show(2677889)
|
||||
say Show(393900588225)
|
||||
say Show(19999999999999999999999)
|
||||
say Format(Time('e'),,3) 'seconds'
|
||||
exit
|
||||
|
||||
Show:
|
||||
arg x
|
||||
return 'Number:' x 'Digital root:' Digitroot(x) 'Additive persistence:' Persistence(x)
|
||||
|
||||
include Functions
|
||||
include Special
|
||||
include Numbers
|
||||
include Abend
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
/*REXX program calculates and displays the digital root and additive persistence. */
|
||||
say 'digital additive' /*display the 1st line of the header.*/
|
||||
say " root persistence" center('number',77) /* " " 2nd " " " " */
|
||||
say "═══════ ═══════════" left('', 77, "═") /* " " 3rd " " " " */
|
||||
say digRoot( 627615)
|
||||
say digRoot( 39390)
|
||||
say digRoot( 588225)
|
||||
say digRoot( 393900588225)
|
||||
say digRoot(89999999999999999999999999999999999999999999999999999999999999999999999999999)
|
||||
say "═══════ ═══════════" left('', 77, "═") /*display the foot separator. */
|
||||
exit 0 /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
digRoot: procedure; parse arg x 1 ox; L=length(x) /*get a number and another copy. */
|
||||
do pers=1 until L==1; $= 0 /*keep summing 'til digRoot≡1 dig*/
|
||||
do j=1 for L; ?= substr(x, j, 1) /*add each digit in the dec. num.*/
|
||||
if datatype(?, 'W') then $= $ + ? /*add a dec. dig to digital root.*/
|
||||
end /*j*/
|
||||
x= $; L=length(x) /*a new #, it may be multi─digit.*/
|
||||
end /*pers*/
|
||||
return center(x,7) center(pers,11) ox /*return a nicely formatted line.*/
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
include Settings
|
||||
|
||||
say version; say 'Digital root'; say
|
||||
numeric digits 30
|
||||
say Show(0)
|
||||
say Show(9)
|
||||
say Show(10)
|
||||
say Show(19)
|
||||
say Show(199)
|
||||
say Show(679)
|
||||
say Show(6788)
|
||||
say Show(39390)
|
||||
say Show(588225)
|
||||
say Show(2677889)
|
||||
say Show(393900588225)
|
||||
say Show(19999999999999999999999)
|
||||
say Format(Time('e'),,3) 'seconds'
|
||||
exit
|
||||
|
||||
Show:
|
||||
arg x
|
||||
return 'Number:' x 'Digital root:' Digitroot(x) 'Additive persistence:' Persistence(x)
|
||||
|
||||
Digitroot:
|
||||
/* Digital root function */
|
||||
procedure expose glob.
|
||||
arg x
|
||||
/* Formula */
|
||||
return 1+(x-1)//9
|
||||
|
||||
Persistence:
|
||||
/* Additive persistence function */
|
||||
procedure expose glob.
|
||||
arg x
|
||||
/* Fast value */
|
||||
if x < 10 then
|
||||
return 0
|
||||
/* Cf definition */
|
||||
do y = 1 until x < 10
|
||||
x = Digitsum(x)
|
||||
end
|
||||
return y
|
||||
|
||||
Digitsum:
|
||||
/* Digitsum function = sum(digits) */
|
||||
procedure expose glob.
|
||||
arg x
|
||||
/* Sum digits */
|
||||
y = 0
|
||||
do n = 1 to Length(x)
|
||||
y = y+Substr(x,n,1)
|
||||
end
|
||||
return y
|
||||
|
||||
include Functions
|
||||
include Numbers
|
||||
include Abend
|
||||
Loading…
Add table
Add a link
Reference in a new issue