OFFSET
0,12
COMMENTS
This sequence lists the number of iterations required of the sequence A330633, the concatenation of the product of adjacent digits, for starting value n until the resulting term equals zero. If the iterative cycle never reaches zero and instead diverges with larger and larger numbers with each iteration then a(n) = -1.
For larger values of n most starting values lead to a divergent series. The first such term is a(166). See the examples below. This reaches 888 after three iterations which is guaranteed to diverge due to the iterative cycle 888 -> 6464 -> 242424 -> 88888, and the series of 8's expands forever. All starting values examined up to 10^8 either reach zero else eventually contain three or more adjacent 8's and will therefore diverge. Unlike similar iterative sequences A329624 and A329198 there appears to be no fixed points or other cyclic behavior.
Up to n = 10^8 the largest number of iterative steps before reaching zero is 23. This is first seen for n = 3178 and for 18520 other starting values. Considering no larger number of steps was found, nor any during a brief test of random numbers larger than 10^8, it is possible this is the largest number of steps to reach zero for all starting values, with the exception of the repunits comprising k 1's which will take k steps to reach zero. A random number with a large number of digits will almost certainly diverge as it will result in 888, or similar divergent numbers, appearing within the iterative term at some step which, as shown above, will diverge.
There are numbers other than repunits of k 1's which take k steps to reach 0, e.g. n = 691...16 with m 1's where m is odd or 491...16 where m is even has a(n) = m + 17. - Robert Israel, Jul 01 2024
LINKS
Robert Israel, Table of n, a(n) for n = 0..10000
EXAMPLE
MAPLE
f:= proc(n) local L, i;
L:= convert(n, base, 10);
if ormap(t -> L[t..t+2] = [8, 8, 8], [$1..nops(L)-2]) then return -1 fi;
parse(cat(seq(L[i]*L[i+1], i=nops(L)-1 .. 1, -1)))
end proc;
for i from 1 to 9 do f(i):= 0 od:
g:= proc(i) option remember; local v;
v:= f(i);
if v = -1 then -1
else v:= procname(v);
if v = -1 then -1 else 1 + v fi
fi;
end proc:
g(0):= 0:
map(g, [$0..200]); # Robert Israel, Jun 30 2024
MATHEMATICA
Array[If[#[[-1]] == 888, -1, Length@ # - 1] &@ NestWhileList[If[Or[# == 0, IntegerLength@ # == 1], 0, FromDigits[Join @@ IntegerDigits[Times @@ # & /@ Partition[IntegerDigits@ #, 2, 1]]]] &, #, And[# > 0, # != 888] &] &, 102, 0] (* Michael De Vlieger, Dec 23 2019 *)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Scott R. Shannon, Dec 22 2019
STATUS
approved