login
A307087
a(n) is the number of steps it takes for the sequence f(0)=f(1)=n, f(x)=(a*b) mod (a+b+1), where a=f(x-1) and b=f(x-2), to reach a cycle.
2
0, 0, 4, 3, 0, 6, 6, 1, 13, 3, 2, 8, 3, 3, 5, 3, 0, 23, 3, 4, 11, 3, 0, 9, 11, 5, 9, 3, 10, 13, 13, 2, 5, 3, 9, 4, 7, 6, 23, 3, 34, 23, 8, 2, 12, 3, 22, 9, 8, 7, 16, 3, 1, 19, 60, 12, 27, 3, 7, 15, 22, 4, 25, 3, 30, 12, 10, 11, 22, 3, 6, 12, 3, 8, 19, 3, 10
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).
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
Sequence in context: A021703 A321209 A139823 * A019756 A154156 A152675
KEYWORD
nonn
AUTHOR
Alex Costea, Mar 23 2019
STATUS
approved