login
Number of 2's that appeared by n-th step when constructing A030717.
8

%I #13 Nov 18 2022 10:13:49

%S 0,0,1,2,3,3,3,3,4,6,8,9,10,11,12,14,16,19,23,26,27,29,32,38,43,48,51,

%T 56,63,71,79,87,94,101,109,116,125,133,140,149,161,174,188,202,217,

%U 233,250,266,284,304,326,347,369,392,418,444,471,499,530,561,593,625,658,692,726,761,797,833,869,906,944

%N Number of 2's that appeared by n-th step when constructing A030717.

%H Michael De Vlieger, <a href="/A358468/b358468.txt">Table of n, a(n) for n = 1..1024</a>

%H Michael De Vlieger, <a href="/A358468/a358468.png">Plot of the n-th row of A030717</a> n = 1..512, showing 2's in red and all other terms in blue.

%t nn = 94; c[_] = 0; k = a[1] = c[1] = 1; Accumulate@ Prepend[Reap[Do[w = Union@ Array[a, k]; t = 0; Do[Set[a[j + k], c[w[[j]]]]; If[a[j + k] == 2, t++], {j, Length[w]}]; Do[c[a[j + k]]++, {j, Length[w]}]; k += Length[w]; Sow[t], {n, nn}]][[-1, -1]], 0] (* _Michael De Vlieger_, Nov 18 2022 *)

%o (Ruby)

%o def A(k, n)

%o a = []

%o ary = [1]

%o n.times{

%o a << ary.count(k)

%o ary += ary.uniq.sort.map{|i| ary.count(i)}

%o }

%o a

%o end

%o p A(2, 100)

%Y Partial sums of A358469.

%Y Cf. A030717, A358466.

%K nonn

%O 1,4

%A _Seiichi Manyama_, Nov 18 2022