%I #36 Nov 11 2019 00:40:27
%S 1,1,1,1,1,1,1,1,1,2,4,3,6,10,12,4,8,18,6,4,3,6,10,12,4,8,18,6,11,3,2,
%T 10,12,4,8,18,3,11,20,6,10,12,4,8,18,6,11,20,18,10,12,2,8,18,6,11,4,
%U 18,28,12,4,8,18,3,11,20,6,28,5,4,8,18,2,11,20,18,28,5,10,8,18,6,11,20,18,28,5,10,12,18
%N Number of iterations of the "Oware" operation until the initial position n is reproduced.
%C The "Oware" operation on n consists of replacing a given "pivot" digit by 0 and then "distribute" the (former) value of that digit on all digits, by increasing by 1 the following digits, "wrapping" around to start over with the first digit after the last has been increased. The first iteration starts with the first digit, but on subsequent iterations one starts with the last digit that has been increased during the previous iteration. "Initial position" means not only the same digits (i.e., the number n) are reproduced, but also the current "pivot" must again be the initial (first) digit.
%H Charlie Neder, <a href="/A216476/b216476.txt">Table of n, a(n) for n = 1..1000</a>
%H E. Angelini, <a href="http://www.cetteadressecomportecinquantesignes.com/AwalENG.htm">Oware (with integers)</a>, Sept. 2012.
%H E. Angelini, <a href="/A216476/a216476.pdf">Oware (with integers)</a> [Cached copy, with permission]
%e The Oware operation on 541 consists of taking the 5 (and making this digit zero) and then increase 5 times the subsequent digits in a cyclic manner : 4->5; 1->2; 0->1; 5->6; 2->3, which yields 163, the '3' being the new starting digit (or "pivot") for the next iteration.
%e Note that after 41 iterations, the number 541 is reproduced, but the current "pivot" is not the first but the last. Only 10 iterations later, one gets again the number 541 with now the first digit being the "pivot". Thus, a(541) = 51.
%e See the link for further examples.
%o (PARI) A216476(n)={my(o=n=Vecsmall(Str(n)),c,p=Mod(0,#n));until(!p & o==n,c++;for(i=1,n[lift(p)+1]-n[lift(p)+1]=48,n[lift(p++)+1]++));c} /* The ++ on a Vecsmall component yields a segfault on PARI versions < 2.4.4. One can replace Vecsmall(...) -> eval(Vec(...)) and 48 -> 0. */
%o (Python)
%o for n in range(1,1001):
%o ..digits = [int(i) for i in str(n)]
%o ..piv, step, arr = 0, 0, digits.copy()
%o ..while not (step and piv == 0 and arr == digits):
%o ....hand = arr[piv]
%o ....arr[piv] = 0
%o ....for k in range(hand):
%o ......piv = (piv+1)%len(arr)
%o ......arr[piv] += 1
%o ....step += 1
%o ..print(n,step) # _Charlie Neder_, Feb 26 2019
%Y Cf. A216502 (indices of record values), A306564.
%K nonn,base,nice
%O 1,10
%A _Eric Angelini_ and _M. F. Hasler_, Sep 11 2012