

A216476


Number of iterations of the "Oware" operation until the initial position n is reproduced.


4



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, 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, 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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,10


COMMENTS

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.


LINKS

Charlie Neder, Table of n, a(n) for n = 1..1000
E. Angelini, Oware (with integers), Sept. 2012.
E. Angelini, Oware (with integers) [Cached copy, with permission]


EXAMPLE

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.
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.
See the link for further examples.


PROG

(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. */
(Python)
for n in range(1, 1001):
..digits = [int(i) for i in str(n)]
..piv, step, arr = 0, 0, digits.copy()
..while not (step and piv == 0 and arr == digits):
....hand = arr[piv]
....arr[piv] = 0
....for k in range(hand):
......piv = (piv+1)%len(arr)
......arr[piv] += 1
....step += 1
..print(n, step) # Charlie Neder, Feb 26 2019


CROSSREFS

Cf. A216502 (indices of record values), A306564.
Sequence in context: A327120 A131388 A131393 * A002326 A285493 A064273
Adjacent sequences: A216473 A216474 A216475 * A216477 A216478 A216479


KEYWORD

nonn,base,nice


AUTHOR

Eric Angelini and M. F. Hasler, Sep 11 2012


STATUS

approved



