OFFSET
1,2
COMMENTS
Partials sums modulo 3 of the sequence : 1, a(1), a(1), a(2), a(2), a(3), a(3), a(4), a(4), a(5), ...
PROG
(Python)
from itertools import islice
from collections import deque
def A094451_gen(): # generator of terms
aqueue, f, b, a = deque([2]), True, 1, 2
yield from (1, 2)
while True:
a = (a+b) % 3
yield a
aqueue.append(a)
if f: b = aqueue.popleft()
f = not f
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Philippe Deléham, Jun 04 2004
STATUS
approved