[go: up one dir, main page]

login
A317540
a(-1) = -1, a(0) = 1, a(n) = A317539(n) - 3*(n-1) for n > 0.
1
-1, 1, 2, 0, 2, 1, -1, 0, -1, 1, -1, 0, 2, 1, 2, 0, -1, 1, -1, 0, 2, 1, -1, 0, -1, 1, 2, 0, 2, 1, 2, 0, -1, 1, -1, 0, 2, 1, -1, 0, -1, 1, -1, 0, 2, 1, 2, 0, -1, 1, 2, 0, 2, 1, -1, 0, -1, 1, 2, 0, 2, 1, 2, 0, -1, 1, -1, 0, 2, 1, -1, 0, -1, 1, -1
OFFSET
-1,3
FORMULA
a(-1) = -1, a(1) = 2, a(4n) = 1, a(4n+2) = 0, a(8n+3) = 2, a(8n+7) = -1, a(8n+1) = a(4n+1), a(1) = 2, a(8n+5) = a(4n-1), for n >= 0.
PROG
(Python)
a = [-1, 1, 2]
print(-1, -1)
print(0, 1)
print(1, 2)
n = 2
while n < 128:
if n%4 == 0:
a = a+[1]
elif n%4 == 2:
a = a+[0]
elif n%8 == 1:
a = a+[a[4*(n//8)+2]]
elif n%8 == 3:
a = a+[2]
elif n%8 == 5:
a = a+[a[4*(n//8)]]
else: # n%8 == 7
a = a+[-1]
print(n, a[n+1])
n = n+1
CROSSREFS
Cf. A317539.
Sequence in context: A060950 A039976 A287267 * A133701 A230417 A287263
KEYWORD
sign
AUTHOR
A.H.M. Smeets, Jul 30 2018
EXTENSIONS
Offset and NAME corrected by R. J. Mathar, Jun 19 2021
STATUS
approved