%I #23 Jan 02 2023 12:30:50
%S 2,8,32,48,64,192,18,16,48,192,18,16,48,192,18,16,48,192,18,16,48,192,
%T 18,16,48,192,18,16,48,192,18,16,48,192,18,16,48,192,18,16,48,192,18,
%U 16,48,192,18,16,48,192,18,16,48,192,18,16,48,192,18,16,48
%N a(n+1) is the product of the last three digits of the sequence up to a(n), start with a(0)=2.
%C Additional rule: if there are fewer than k=3 digits in the sequence so far, then it is "extended to the left" with the first digit (i.e., that digit is repeated as often as necessary).
%C For any starting value, the sequence obtained through these rules ends either in repeating 0's, or in repeating 1's, or in the cycle (16,48,192,18). So 2 is the least starting value for which this nontrivial cycle is entered, after 5 iterations, at a(5)=192.
%H E. Angelini, <a href="http://list.seqfan.eu/oldermail/seqfan/2014-August/013413.html">Multiplication by themselves of the last k digits</a>.
%F a(n+4)=a(n) for n > 4.
%e a(1) = 2*2*2 = 8 (here the initial digit is used 3 times), a(2) = 2*2*8 = 32 (here the initial digit is used twice to get k=3 factors), a(3) = 8*3*2 = 48, ...
%o (PARI) A238984(n,a=2,k=3,print_all=0)={my(L=if(a,digits(a),[0]),S=Str(-k".."));while(#L<k,L=concat(L[1],L));for(m=1,n,print_all&&print1(a",");a=prod(i=1,k,L[i]);L=vecextract(concat(L,if(a,digits(a))),S));a}
%Y Cf. A239419, A239616, A239721, A239722.
%K nonn,base
%O 0,1
%A _Eric Angelini_ and _M. F. Hasler_, Aug 01 2014
%E PARI program corrected by _Jens Kruse Andersen_, Aug 02 2014