OFFSET
0,2
COMMENTS
a(n) = -1 iff n ends in 00 (e.g. 100, 200, ...). (It is sufficient to check the 100 starts i,j, 0 <= i, j <= 9.)
5 is the unique number common to the trajectories of all numbers from 1 to 99.
Iterate the map k -> A209685(k), starting at n, until reaching 5, or -1 if 5 is never reached.
REFERENCES
Eric Angelini, Posting to Math Fun Mailing List, Mar 11 2012.
FORMULA
The sequence is ultimately periodic.
EXAMPLE
For n=4 we have S(0)=4, S(1)=4, S(2)=8, S(3)=12, S(4)=3, S(5)=5, so a(4)=5.
PROG
(PARI) a(n)=my(m=0, t, k); while(n!=5, t=if(n>9, n%100\10+n%10, n+m%10); m=n; n=t; k++); k \\ Charles R Greathouse IV
CROSSREFS
KEYWORD
sign,base
AUTHOR
N. J. A. Sloane, Mar 11 2012
EXTENSIONS
Corrected and extended by Charles R Greathouse IV, Mar 11 2012
STATUS
approved