[ abs 0 swap [ base share /mod rot + swap dup 0 = until ] drop ] is digitsum ( n --> n ) [ 0 swap [ dup base share > while dip 1+ digitsum again ] ] is digitalroot ( n --> n n ) [ dup digitalroot rot echo say " has additive persistance " swap echo say " and digital root of " echo say ";" cr ] is task ( n --> ) 627615 task 39390 task 588225 task 393900588225 task