OFFSET
0,3
COMMENTS
Abmod sequences are defined as follows:
Abmod(x,y,0) = x,
Abmod(x,y,1) = y,
Abmod(x,y,k) = (a*b) mod (a+b+1), where a and b are the 2 previous terms (a = Abmod(x,y,k-1), b = Abmod(x,y,k-2)).
It seems that a(n)=3 if n=6k+3 for nonnegative integer k.
Conjecture: for every n, a(n) is finite (that is, the sequence ends up in a cycle).
LINKS
Alex Costea, Table of n, a(n) for n = 0..10000
EXAMPLE
For a(8), the sequence f is 8, 8, 13, 16, 28, 43, 52, 28, 79, 52, 16, 4, 1, and then 4, 4, 7 repeated, thus a(8) is 13.
MATHEMATICA
cyclePos[s_] := Module[{sp = SequencePosition[s[[1 ;; -3]], s[[-2 ;; -1]]]}, If[Length[sp] == 0, 0, sp[[1, 1]]]]; a[n_] := Module[{f, g}, g[a_, b_] := Mod[a*b, a + b + 1]; f[0] = f[1] = n; f[k_] := f[k] = g[f[k - 1], f[k - 2]]; s = {}; m = 0; While[Length[s] < 4 || cyclePos[s] == 0, AppendTo[s, f[m]]; m++]; cyclePos[s] - 1]; Array[a, 100, 0] (* Amiram Eldar, Jul 06 2019 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Alex Costea, Mar 23 2019
STATUS
approved