%I #47 Sep 30 2022 14:38:16
%S 1,2,1,3,1,4,1,2,1,5,1,6,1,2,1,3,1,7,1,2,1,8,1,4,1,2,1,3,1,9,1,2,1,10,
%T 1,5,1,2,1,3,1,11,1,2,1,4,1,12,1,2,1,3,1,6,1,2,1,13,1,14,1,2,1,3,1,4,
%U 1,2,1,5,1,7,1,2,1,3,1,15,1,2,1,16,1,4,1,2,1,3,1,8,1,2,1,6,1,5,1,2,1,3,1,17,1
%N Pit harvesting sequence for winning solitaire Tchoukaillon (or Mancala).
%C From _Benoit Cloitre_, Mar 09 2007: (Start)
%C The sequence can be constructed as follows using parentheses (NP means "term not in parentheses"):
%C Start from the positive integers:
%C 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,...
%C Step 1: put the least NP "1" in parentheses and every 2 terms giving:
%C (1),2,(3),4,(5),6,(7),8,(9),10,(11),12,(13),14,(15),16,(17),18,(19),...
%C Step 2: put the least NP "2" in 2 parentheses and every 3 NP giving:
%C (1),((2)),(3),4,(5),6,(7),((8)),(9),10,(11),12,(13),((14)),(15),16,(17),...
%C so that between 2 consecutives ((x)) there are 2 NP.
%C Step 3: put the least NP "4" in 3 parentheses and every 4 NP giving:
%C (1),((2)),(3),(((4))),(5),6,(7),((8)),(9),10,(11),12,(13),((14)),(15),(((16))),...
%C so that between 2 consecutives (((x))) there are 3 NP.
%C Step 4: put the least NP "6" in 4 parentheses and every 5 NP giving:
%C (1),((2)),(3),(((4))),(5),((((6)))),(7),((8)),(9),10,(11),12,(13),((14)),(15),(((16))),...
%C so that between 2 consecutives ((((x)))) there are 4 NP.
%C Iterating the process indefinitely yields:
%C (1),((2)),(3),(((4))),(5),((((6)))),(7),((8)),(9),(((((10))))),(11),...
%C Count the parentheses:
%C 1,2,1,3,1,4,1,2,1,5,1,... - this is the sequence.
%C (End)
%C From _Benoit Cloitre_, Jul 26 2007: (Start)
%C A simpler way to construct the sequence: start from
%C 1,_,1,_,1,_,1,_,1,_,1,_,1,_,1,... where 1's are spaced by one hole;
%C fill first hole with 2 and leave 2 holes between two 2's giving
%C 1,2,1,_,1,_,1,2,1,_,1,_,1,2,1,...;
%C fill new first hole with 3 and leave 3 holes between two 3's giving
%C 1,2,1,3,1,_,1,2,1,_,1,_,1,2,1,3...;
%C iterating the process indefinitely yields the sequence.
%C (End)
%C Ordinal transform of A130747. - _Benoit Cloitre_, Aug 03 2007
%C Although this sequence and A130747 are not fractal sequences (according to Kimberling's definition), we say they are "mutual fractal sequences" since the ordinal transform of one gives the other. - _Benoit Cloitre_, Aug 03 2007
%C The smallest n with a(n) = k is circa k^2/Pi.
%C The element n >= 0 occurs in this sequence with limiting density 1/(n*(n+1)).
%H L. K. Mitchell, <a href="/A028920/b028920.txt">Table of n, a(n) for n=0..3280</a>
%H Franklin T. Adams-Watters, <a href="/A002260/a002260.txt">Doubly Fractal Sequences and ordinal transform</a>
%H D. M. Broline and Daniel E. Loeb, <a href="https://arxiv.org/abs/math/9502225">The combinatorics of Mancala-Type games: Ayo, Tchoukaillon and 1/Pi</a>, arXiv:math/9502225 [math.CO], 1995; J. Undergrad. Math. Applic., vol. 16 (1995), pp. 21-36.
%H N. J. A. Sloane, <a href="http://neilsloane.com/doc/sg.txt">My favorite integer sequences</a>, in Sequences and their Applications (Proceedings of SETA '98).
%H <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>
%F a(2n+1) = 1 + A104706(n+1), a(2n) = 1. - _Benoit Cloitre_, Mar 09 2007
%F The sieve of A007952 processes n in the a(n)-th pass. a(A007952(n)) = n+1.
%t n = 15; Fold[If[Length@Position[#1, 0] > 0, ReplacePart[#1,First /@ Partition[Position[#1, 0], #2 + 1, #2 + 1, {1, 1}] -> #2], #1] &, Flatten@Array[{1, 0} &, n], Range[2, 2 n]] (* _Birkas Gyorgy_, Feb 26 2011 *)
%o (C++)
%o int A028920(int n) {
%o for (int m = 1; ; m++) {
%o if (n%(m+1) == 0)
%o return m;
%o n = n*m/(m+1);
%o }
%o } /* _David W. Wilson_, Feb 25 2010 */
%o (PARI) a(n) = {ok = 0; m = 1; while (!ok, if ((n%(m+1) == 0), ok = 1, n = n*m\(m+1); m++);); m;} \\ _Michel Marcus_, Dec 06 2015
%Y Cf. A002491, A007952, A028931, A028932, A028933, A130747.
%K nonn
%O 0,2
%A _David W. Wilson_
%E Additional comments from _David W. Wilson_, Feb 25 2010