A121496 Run lengths of successive numbers in A068225.
1, 2, 2, 1, 3, 4, 4, 3, 5, 6, 6, 5, 7, 8, 8, 7, 9, 10, 10, 9, 11, 12, 12, 11, 13, 14, 14, 13, 15, 16, 16, 15, 17, 18, 18, 17, 19, 20, 20, 19, 21, 22, 22, 21, 23, 24, 24, 23, 25, 26, 26, 25, 27, 28, 28, 27, 29, 30, 30, 29, 31, 32, 32, 31, 33, 34, 34, 33, 35, 36, 36, 35, 37, 38, 38
Offset: 1
Examples
The fifth run of successive numbers in A068225 is 8, 9, 10 with run length three so a(5) = 3.
Links
- Colin Barker, Table of n, a(n) for n = 1..1000
- Index entries for linear recurrences with constant coefficients, signature (1,0,0,1,-1).
Programs
-
Mathematica
Rest@ CoefficientList[Series[x (1 + x - x^3 + x^4)/((1 - x)^2*(1 + x) (1 + x^2)), {x, 0, 75}], x] (* Michael De Vlieger, Oct 02 2017 *)
-
PARI
a(n) = if(n%2==1,(n+1)/2,if(n%4==0,(n/2)-1,(n/2)+1)) for(n=1,80,print1(a(n),", "))
-
PARI
Vec(x*(1+x-x^3+x^4)/((1-x)^2*(1+x)*(1+x^2)) + O(x^100)) \\ Colin Barker, Apr 08 2016
Formula
a(2*k-1) = k, a(4*k) = 2*k-1, a(4*k-2) = 2*k, for k >= 1.
From Colin Barker, Apr 08 2016: (Start)
a(n) = a(n-1) + a(n-4) - a(n-5) for n > 5.
G.f.: x*(1+x-x^3+x^4) / ((1-x)^2*(1+x)*(1+x^2)). (End)
a(n) = (2*n+1-4*cos(n*Pi/2)-cos(n*Pi))/4. - Wesley Ivan Hurt, Oct 02 2017
Comments