OFFSET
2,1
COMMENTS
The k-th variable can take k+1 different values.
From Charlie Neder, Oct 01 2018: (Start)
a(n) is the smallest k congruent to m-2 modulo m for 2 <= m <= n+1.
Proof: All variables will be equal for the first time precisely when they all are equal to 2, in which case each variable has changed from its maximum value m to 2. Additionally, this k is lcm(2,3,...,m) - 2, since advancing two more steps will return all variables to their maximum values.
Adding a variable that only takes one value {1} results in A070198 (LCM - 1). (End)
LINKS
Felix Fröhlich, Visual representation of a(3)
FORMULA
a(n) = A003418(n+1) - 2. - Charlie Neder, Oct 02 2018
EXAMPLE
In case of two variables, the first can take two values (1 and 2) and the second three values (1, 2 and 3). Performing the operation on the variables generates sequences of values 2, 1, 2, 1, 2, 1, ... for first variable and 3, 2, 1, 3, 2, 1, ... for second variable. After four steps, the value of both variables is 2, so a(2) = 4.
PROG
(PARI) a(n) = my(v=vector(n, x, x++), w=v, i=0); while(1, if(vecmax(v)==vecmin(v), return(i)); for(k=1, #v, if(v[k]==1, v[k]=w[k], v[k]--)); i++) \\ Felix Fröhlich, Feb 19 2017
(Python)
from math import gcd
lcm = 2
for n in range(3, 53):
..lcm *= n // gcd(lcm, n)
..print(n-1, lcm-2) # Charlie Neder, Oct 02 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Felix Fröhlich, Jan 25 2015
EXTENSIONS
Value of a(6) corrected and more terms from Felix Fröhlich, Mar 25 2015
Illustration and program replaced with improved versions by Felix Fröhlich, Feb 19 2017
Corrected and extended by Charlie Neder, Oct 01 2018
STATUS
approved