login
A175424
a(n) is the number of steps of iterations of {(((D_k^D_(k-1))^D_(k-2))^...)^D_1, where D_k is the k-th digit D of number r and k is the number of digits of number r in decimal expansion of r (A055642)} needed to reach a single-digit number starting at r = n, or a(n) = -1 if a single-digit number is never reached.
7
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, -1, -1, 3, 3, 2, 1, 1, 1, 4, 3, -1, -1, 3, 3, 3, 1, 1, 2, 2, 3, 3, 3, 2, 2, 2, 1, 1, 2, 3, 2, 4, 3, 2, 3, 2, 1, 1, 3, 3, 2, 3, 3, 3, 3, 2, 1, 1, 4, 3, 3, 3, 3, 3, 2, 3, 1, 1, 3, 2, 3, 2, 3, 2, 2, 2, 1, 1, 3, 3, 3, 3, 2, 2, 2, 2
OFFSET
0,25
COMMENTS
Conjecture: max(a(n)) = 4.
EXAMPLE
For n = 33: a(33) = 4 because for the number 33 there are 4 steps of defined iteration: {3^3 = 27}, {7^2 = 49}, {9^4 = 6561}, {((1^6)^5)^6 = 1}.
PROG
(PARI) f(n) = if (n, my(d=digits(n), r=d[#d]); if (!vecmin(d), return(0)); forstep (k=#d-1, 1, -1, r = r^d[k]; ); r); \\ A175420
findpos(n, list) = {forstep (k=#list, 1, -1, if (list[k] == n, return (k)); ); return (0); }
a(n) = {my(list = List(n), nb = 0); while (n >= 10, n = f(n); my(k=findpos(n, list)); nb++; if (k, if (k==#list-1, if (list[k]<10, return (nb), return(-1)), return(-1)); ); listput(list, n); ); return (nb); } \\ Michel Marcus, Jan 20 2022
KEYWORD
sign,base
AUTHOR
Jaroslav Krizek, May 09 2010
STATUS
approved