login
a(n) = a(n-1) - a(floor(n/2)), with a(1)=1.
2

%I #12 Jun 09 2022 02:24:47

%S 1,0,-1,-1,-1,0,1,2,3,4,5,5,5,4,3,1,-1,-4,-7,-11,-15,-20,-25,-30,-35,

%T -40,-45,-49,-53,-56,-59,-60,-61,-60,-59,-55,-51,-44,-37,-26,-15,0,15,

%U 35,55,80,105,135,165,200,235,275,315,360,405,454,503,556,609,665,721,780,839,899,959,1020,1081,1141,1201,1260

%N a(n) = a(n-1) - a(floor(n/2)), with a(1)=1.

%C Period of oscillations above and below the axis more than doubles at each cycle.

%F G.f.: A(x) satisfies: A(x) = (x - (1 + x)*A(x^2))/(1 - x). - _Ilya Gutkovskiy_, May 04 2019

%e a(14) = a(13) - a(7) = 5 - 1 = 4.

%e a(15) = a(14) - a(7) = 4 - 1 = 3.

%o (Python)

%o from itertools import islice

%o from collections import deque

%o def A062186_gen(): # generator of terms

%o aqueue, f, b, a = deque([0]), True, 1, 0

%o yield from (1,0)

%o while True:

%o a -= b

%o yield a

%o aqueue.append(a)

%o if f: b = aqueue.popleft()

%o f = not f

%o A062186_list = list(islice(A062186_gen(),40)) # _Chai Wah Wu_, Jun 08 2022

%Y Cf. A033485, A062187, A062188.

%K sign

%O 1,8

%A _Henry Bottomley_, Jun 13 2001