cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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

This page as a plain text file.
%I A216476 #40 Jan 07 2025 15:16:34
%S A216476 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 A216476 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 A216476 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 A216476 Number of iterations of the "Oware" operation until the initial position n is reproduced.
%C A216476 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 A216476 Charlie Neder, <a href="/A216476/b216476.txt">Table of n, a(n) for n = 1..1000</a>
%H A216476 E. Angelini, <a href="http://www.cetteadressecomportecinquantesignes.com/AwalENG.htm">Oware (with integers)</a>, Sept. 2012.
%H A216476 E. Angelini, <a href="/A216476/a216476.pdf">Oware (with integers)</a> [Cached copy, with permission]
%e A216476 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 A216476 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 A216476 See the link for further examples.
%o A216476 (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 A216476 (Python)
%o A216476 for n in range(1, 1001):
%o A216476   digits = [int(i) for i in str(n)]
%o A216476   piv, step, arr = 0, 0, digits.copy()
%o A216476   while not (step and piv == 0 and arr == digits):
%o A216476     hand = arr[piv]
%o A216476     arr[piv] = 0
%o A216476     for k in range(hand):
%o A216476       piv = (piv+1)%len(arr)
%o A216476       arr[piv] += 1
%o A216476     step += 1
%o A216476   print(n, step) # _Charlie Neder_, Feb 26 2019
%Y A216476 Cf. A216502 (indices of record values), A306564.
%K A216476 nonn,base,nice
%O A216476 1,10
%A A216476 _Eric Angelini_ and _M. F. Hasler_, Sep 11 2012