Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
28
Task/Digital-root/ASIC/digital-root.asic
Normal file
28
Task/Digital-root/ASIC/digital-root.asic
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
REM Digital root
|
||||
DATA 1&, 14&, 267&, 8128&, 39390&, 588225&, 627615&
|
||||
FOR I = 0 TO 6
|
||||
READ A&
|
||||
N& = A&
|
||||
Base = 10
|
||||
GOSUB CalcDRootAndPers:
|
||||
PRINT A&;
|
||||
PRINT Pers;
|
||||
PRINT Root
|
||||
NEXT I
|
||||
END
|
||||
|
||||
CalcDRootAndPers:
|
||||
REM Results: Root - digital root; Pers - persistance
|
||||
Pers = 0
|
||||
WHILE N& >= Base
|
||||
S = 0
|
||||
Loop:
|
||||
NModBase& = N& MOD Base
|
||||
S = S + NModBase&
|
||||
N& = N& / Base
|
||||
IF N& > 0 THEN Loop:
|
||||
Pers = Pers + 1
|
||||
N& = S
|
||||
WEND
|
||||
Root = N&
|
||||
RETURN
|
||||
Loading…
Add table
Add a link
Reference in a new issue