%I #34 Dec 22 2021 02:18:46
%S 1,2,1,2,3,3,1,2,4,4,3,4,1,2,5,5,3,5,1,2,4,5,3,4,6,6,1,2,6,3,7,7,6,4,
%T 7,7,5,6,1,2,5,3,8,8,7,4,8,8,1,2,6,7,3,6,5,8,4,8,5,6,9,9,1,2,9,3,10,
%U 10,9,4,10,10,7,8,9,5,7,10,1,2,9,7,3,4,9,6,11,11,10,11
%N Start with a sequence of 1's, then replace every other 1 with a 2; then replace every third of the remaining 1's with a 3 and every third of the remaining 2's with a 3; then replace every fourth remaining 1, 2 or 3 with a 4; and so on. The limiting sequence is shown here.
%C The position of the 1's is given by A000960. - _T. D. Noe_, Oct 26 2004
%H T. D. Noe, <a href="/A100002/b100002.txt">Table of n, a(n) for n = 1..10000</a>
%H T. D. Noe, <a href="/A098119/a098119.gif">Plot of first 5000 terms</a>
%H A <a href="http://www.google.com/groups?selm=clhfm9%243eu%241%40news.ks.uiuc.edu">post</a> on sci.math.research newsgroup.
%F a(1, j)=1 for all j>=1; a(n, j)=a(n-1, j) except when #{i<=j s.t. a(n-1, i)=a(n-1, j)} is multiple of n, in which case a(n, j)=n; a(j) is the limit of the (stationary) a(n, j) when n tends to infinity.
%F It appears that the maximal value among the first n terms grows like sqrt(4n/3).
%F Note that the first occurrence of n is bounded by A000960; that is, A100287(n) <= A000960(n), with equality only for n=1. - _T. D. Noe_, Nov 12 2004
%e Here are the first 6 stages in the construction:
%e 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...
%e 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2 1 2...
%e 1 2 1 2 3 3 1 2 1 2 3 3 1 2 1 2 3 3 1 2 1 2 3 3 1 2 1 2 3 3...
%e 1 2 1 2 3 3 1 2 4 4 3 4 1 2 1 2 3 3 1 2 4 4 3 4 1 2 1 2 3 3...
%e 1 2 1 2 3 3 1 2 4 4 3 4 1 2 5 5 3 5 1 2 4 5 3 4 1 2 1 2 3 3...
%e 1 2 1 2 3 3 1 2 4 4 3 4 1 2 5 5 3 5 1 2 4 5 3 4 6 6 1 2 6 3...
%e ...
%t nn=100; t=Table[1, {nn}]; done=False; k=1; While[ !done, k++; cnt=Table[0, {k-1}]; Do[If[t[[i]]<k, cnt[[t[[i]]]]++; If[Mod[cnt[[t[[i]]]], k]==0, t[[i]]=k]], {i, nn}]; done=(Max[cnt]<k)]; t (* _T. D. Noe_ *)
%t a[n_] := Fold[Function[{b1, b2},Fold[Function[{a1, a2},ReplacePart[a1, Pick[Position[a1, a2], Take[Flatten[Array[{Array[0 &, b2 - 1], 1} &, Length[a1]]], Length[Position[a1, a2]]], 1] -> b2]], b1, Range[b2 - 1]]], Array[1 &, n], Range[2, 2 Sqrt[n/Pi] + 1]]; a[100] (* _Birkas Gyorgy_, Feb 06 2011 *)
%o /* C */ #define MAXVAL 2048 /* Large enough... */ unsigned int counts[MAXVAL][MAXVAL]; /* Initialized at all 0 */ unsigned int seq_value (void) /* Successive calls return values in the sequence, in order. */ { unsigned int value; unsigned int i; value = 1; for ( i=2; i<MAXVAL; i++ ) if ( ++counts[i][value] >= i ) { counts[i][value] = 0; value = i; } return value; }
%Y Cf. A100287 (first occurrence of n).
%K easy,nice,nonn
%O 1,2
%A _David A. Madore_, Oct 25 2004