A308006 Iterate the map x->A308005(x) starting at x=n; a(n) is the number of steps before the first repeated term is encountered.
3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 0, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 1, 2, 1
Offset: 0
Examples
0 -> 11 -> 220 -> 33 -> 220 -> ... and a number is repeated at step 4, so a(0)=3. 1 -> 110 -> 231 -> 231 -> 231 -> ..., so a(1) = 2. 22 -> 22 -> 22 -> ... is a fixed point, so a(22) = 0.
Links
- Robert Israel, Table of n, a(n) for n = 0..10000
Crossrefs
Cf. A308005.
Programs
-
Maple
# using Maple procedure A308006 from that sequence f:= proc(n) local t,S,i; S:= {n}; t:= n; do t:= A308005(t); if member(t,S) then return nops(S)-1 fi; S:= S union {t}; od end proc: map(f, [$0..100]); # Robert Israel, May 14 2019