A262986 Start of first run of length n in Golomb's sequence A001462.
1, 2, 6, 12, 24, 39, 63, 91, 123, 168, 218, 273, 345, 423, 507, 597, 709, 828, 954, 1087, 1247, 1415, 1591, 1775, 1991, 2216, 2450, 2693, 2945, 3235, 3535, 3845, 4165, 4495, 4869, 5254, 5650, 6057, 6475, 6943, 7423, 7915, 8419, 8935, 9463, 10048, 10646, 11257, 11881, 12518
Offset: 1
Keywords
Examples
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.
Programs
-
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 *)
-
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
Formula
a(1) = 1; a(n+1) = a(n) + A001462(n)*n.
Extensions
More terms from Altug Alkan, Oct 06 2015
Comments