Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #13 Aug 22 2019 09:37:17
%S 3,50,3,3,10,3,3,-17,3,3,11,3,3,5,3,3,6,3,3,5,3,3,-120,3,3,6,3,3,-121,
%T 3,3,5,3,3,13,3,3,-1688,3,3,-24,3,3,7,3,3,15,3,3,-21,3,3,32,3,3,-191,
%U 3,3,19,3,3,-12,3,3,36,3,3,14,3,3,-194,3,3,17,3,3,16,3,3,22,3,3
%N Let b(0)=n, b(1)=n+1, b(2)=n+2, and b(k)=(b(k-3)*b(k-2)*b(k-3)) mod (b(k-3)+b(k-2)+b(k-1)) for k>=3. Continue until either b(k)=0, in which case a(n)=k, or the ordered triple [b(k-2),b(k-1),b(k)] has appeared before, in which case a(n)=-k. If neither of these ever occur, then a(n)=0.
%C If b(k)=0 we get b(k+1)=0, b(k+2)=0, and the sequence ends because 0 mod 0 is undefined. If [b(k-2),b(k-1),b(k)] has appeared before, the sequence has entered a cycle.
%C a(n)=3 unless n==2 (mod 3).
%C Can a(n)=0?
%H Robert Israel, <a href="/A309869/b309869.txt">Table of n, a(n) for n = 1..10000</a>
%F a(26-6*(-1)^k+132*k)=5. Conjecture: the only other n for which a(n)=5 are 14 and 32. - _Robert Israel_, Aug 21 2019
%e a(14)=5 because b(3)=(14*15*16) mod (14+15+16)=30, b(4)=(15*16*30) mod (15+16+30)=2, and b(5)=(16*30*2) mod (16+30+2)=0.
%e a(8)=-17 because (b(15),b(16),b(17))=(21,18,18)=(b(11),b(12),b(13)).
%p f:= proc(m) local a,b,c, t, n, s, S;
%p a:= m; b:= m+1; c:= m+2;
%p S:= {[m,m+1,m+2]};
%p for n from 3 to 10^6 do
%p t:= (a*b*c) mod (a+b+c);
%p if t = 0 then return n fi;
%p a:= b; b:= c; c:= t;
%p s:= [a,b,c];
%p if member(s,S) then return -n fi;
%p S:= S union {s};
%p od;
%p FAIL
%p end proc:
%p map(f, [$1..100]);
%K sign
%O 1,1
%A _J. M. Bergot_ and _Robert Israel_, Aug 20 2019