25 lines
337 B
Plaintext
25 lines
337 B
Plaintext
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
|