login
For any n > 0, define the sequence b(1) = n, b(i+1) = (b(i) * i) mod (b(i) + i); a(n) is the least i such that b(i) = 0, or -1 if 0 is never reached.
1

%I #32 Mar 03 2020 09:57:28

%S 1,13,3,85,13,85,7,58,4,13,7,85,5,7,13,58,58,85,85,13,5,85,7,291,13,

%T 85,58,85,58,7,85,291,85,85,13,58,13,58,291,11,6,58,13,7,13,85,7,291,

%U 58,85,9,85,7,13,13,58,85,13,9,58,291,291,13,11

%N For any n > 0, define the sequence b(1) = n, b(i+1) = (b(i) * i) mod (b(i) + i); a(n) is the least i such that b(i) = 0, or -1 if 0 is never reached.

%H Rémy Sigrist, <a href="/A329983/b329983.txt">Table of n, a(n) for n = 0..10000</a>

%o (Python) def k(a,b):

%o return ((a*b)%(a+b))

%o numberList=[]

%o def repeat(a):

%o i=1

%o while a!=0:

%o a= k(a,i)

%o i=i+1

%o numberList.append(i)

%o for x in range(10000):

%o repeat(x)

%o print(numberList)

%o (PARI) f(m, n) = (m*n) % (m+n);

%o a(n) = {my(i=1); while (n, n = f(n, i); i++;); i;} \\ _Michel Marcus_, Nov 28 2019

%Y Cf. A308651.

%K nonn

%O 0,2

%A _Stefan Gog_, Nov 26 2019