login
Sequence begins 1, 1, 1; for even n > 3, a(n) = a(n/2 - 1) + a(n/2 + 1); for odd n > 3, a(n) = -a((n-1)/2).
1

%I #26 Apr 23 2023 22:11:25

%S 1,1,1,2,-1,3,-1,0,-2,5,1,-2,-3,3,1,-3,0,5,2,-1,-5,3,-1,-2,2,1,3,-2,

%T -3,0,-1,1,3,2,0,2,-5,4,-2,-3,1,2,5,-6,-3,1,1,1,2,-1,-2,5,-1,-1,-3,0,

%U 2,-2,3,-4,0,1,1,2,-1,3,-3,3,-2,4,0,-5,-2,6,5,-7,-4,1,2,-1

%N Sequence begins 1, 1, 1; for even n > 3, a(n) = a(n/2 - 1) + a(n/2 + 1); for odd n > 3, a(n) = -a((n-1)/2).

%H Kevin Ryde, <a href="/A359368/b359368.txt">Table of n, a(n) for n = 1..10000</a>

%H Kevin Ryde, <a href="/A359368/a359368.gp.txt">PARI/GP Code</a>

%e The recurrence for the terms begins:

%e a(4) = a(1) + a(3) = 2

%e a(5) = -a(2) = -1

%e a(6) = a(2) + a(4) = 3

%e a(7) = -a(3) = -1

%e a(8) = a(3) + a(5) = 0

%e a(9) = -a(4) = -2

%t a[1]=a[2]=a[3]=1; a[n_]:=If[EvenQ[n],a[n/2-1]+a[n/2+1],-a[(n-1)/2]]; Array[a,80] (* _Stefano Spezia_, Dec 29 2022 *)

%o (Python)

%o def Seq(n): # generates n terms

%o seq = [1,1,1]

%o k = 0

%o while len(seq) < n:

%o seq += [seq[k] + seq[k+2]]

%o seq += [-1*seq[k+1]]

%o k += 1

%o return seq

%o (PARI) See links.

%K sign,easy

%O 1,4

%A _Eden Lippmann_, Dec 28 2022