OFFSET
1,2
COMMENTS
FORMULA
a(1) = 1; a(n+1) = a(n) + A001462(n)*n.
EXAMPLE
Since Golomb's sequence starts 1,2,2,3,3,4,4,4,5,... the first run of length three starts at position 6, so a(3) = 6.
MATHEMATICA
a[1] = 1; a[n_] := a[n] = 1 + a[n - a[a[n - 1]]]; s = Array[a, {13000}]; t = Most@ Map[Last, Tally@ s]; Table[Total@ Take[t, First@ Flatten@ Position[t, n]] - n + 1, {n, 50}] (* Michael De Vlieger, Oct 07 2015, after Robert G. Wilson v at A001462 *)
PROG
(PARI) a(n) = if (n<2, 1, a(n-1)+ t(n-1)*(n-1));
t(n) = local(A, t, i); if(n<3, max(0, n), A=vector(n); t=A[i=2]=2; for(k=3, n, A[k]=A[k-1]+if(t--==0, t=A[i++ ]; 1)); A[n]);
vector(100, n, a(n))\\ Altug Alkan, Oct 06 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Glen Whitney, Oct 06 2015
EXTENSIONS
More terms from Altug Alkan, Oct 06 2015
STATUS
approved