|
|
A121496
|
|
Run lengths of successive numbers in A068225.
|
|
1
|
|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
|
|
LINKS
|
|
|
FORMULA
|
a(2*k-1) = k, a(4*k) = 2*k-1, a(4*k-2) = 2*k, for k >= 1.
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)
|
|
EXAMPLE
|
The fifth run of successive numbers in A068225 is 8, 9, 10 with run length three so a(5) = 3.
|
|
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 *)
|
|
PROG
|
(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
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,easy
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|