|
|
A104145
|
|
a(1) = 1; let A(k) = sequence of first 2^(k-1) terms; then A(k+1) is concatenation of A(k) and (A(k)-1) if a(k) is odd, or concatenation of A(k) and (A(k)+1) if a(k) is even.
|
|
2
|
|
|
1, 0, 2, 1, 2, 1, 3, 2, 0, -1, 1, 0, 1, 0, 2, 1, 2, 1, 3, 2, 3, 2, 4, 3, 1, 0, 2, 1, 2, 1, 3, 2, 0, -1, 1, 0, 1, 0, 2, 1, -1, -2, 0, -1, 0, -1, 1, 0, 1, 0, 2, 1, 2, 1, 3, 2, 0, -1, 1, 0, 1, 0, 2, 1, 0, -1, 1, 0, 1, 0, 2, 1, -1, -2, 0, -1, 0, -1, 1, 0, 1, 0, 2, 1, 2, 1, 3, 2, 0, -1, 1, 0, 1, 0, 2, 1, -1, -2, 0, -1, 0, -1, 1, 0, -2, -3, -1, -2, -1, -2, 0, -1, 0, -1, 1
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
LINKS
|
|
|
FORMULA
|
|
|
EXAMPLE
|
a(3) = 2 is even, so A(4) (1,0,2,1,2,1,3,2), the first 8 terms of the sequence, is A(3) (1,0,2,1) concatenated with each term of A(3) plus one (2,1,3,2).
|
|
PROG
|
(Python)
from itertools import count, islice
def a_gen():
yield 1
A = [1]
for k in count(0):
for i in range(2**(k)):
x = A[i]+(-1)**abs(A[k])
A.append(x)
yield x
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,sign
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|