Data update
This commit is contained in:
parent
61b93a2cd1
commit
5af6d93694
858 changed files with 20572 additions and 2082 deletions
24
Task/Digital-root/BASIC256/digital-root.basic
Normal file
24
Task/Digital-root/BASIC256/digital-root.basic
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
global dr
|
||||
global ap
|
||||
|
||||
dim a = {627615, 39390, 588225}
|
||||
|
||||
for i = 0 to a[?]-1
|
||||
dr = digitalRoot(a[i])
|
||||
print a[i], "Additive Persistence = "; ap, "Digital root = "; dr
|
||||
next i
|
||||
end
|
||||
|
||||
function digitalRoot(n)
|
||||
ap = 0
|
||||
do
|
||||
dr = 0
|
||||
while n > 0
|
||||
dr += n mod 10
|
||||
n = n \ 10
|
||||
end while
|
||||
ap += 1
|
||||
n = dr
|
||||
until dr < 10
|
||||
return dr
|
||||
end function
|
||||
Loading…
Add table
Add a link
Reference in a new issue