login
A289256
a(1) = a(2) = a(3) = 2; a(n) = a(n-a(n-1)) + a(n-a(n-3)-1) for n > 3.
1
2, 2, 2, 4, 4, 4, 4, 6, 6, 8, 6, 8, 8, 8, 8, 10, 10, 12, 10, 14, 10, 14, 12, 16, 14, 16, 14, 16, 16, 16, 16, 18, 18, 20, 18, 22, 18, 24, 18, 24, 20, 26, 22, 26, 22, 28, 24, 30, 24, 30, 24, 30, 26, 32, 28, 32, 30, 32, 30, 32, 32, 32, 32, 34, 34, 36, 34, 38, 34, 40, 34, 42, 34, 42, 36, 44, 38, 44, 38, 46, 40, 48
OFFSET
1,1
MATHEMATICA
a[n_] := a[n] = If[n <= 3, 2, a[n - a[n - 1]] + a[n - a[n - 3] - 1]]; Array[a, 82] (* Michael De Vlieger, Jun 30 2017 *)
PROG
(PARI) q=vector(10^5); q[1]=q[2]=q[3]=2; for(n=4, #q, q[n] = q[n-q[n-1]]+q[n-1-q[n-3]]); q
(Python)
l=[0, 2, 2, 2]
for n in range(4, 101): l+=[l[n - l[n - 1]] + l[n - l[n - 3] - 1], ]
print(l[1:]) # Indranil Ghosh, Jul 01 2017
CROSSREFS
Sequence in context: A340743 A317841 A007614 * A287155 A287654 A355911
KEYWORD
nonn
AUTHOR
Altug Alkan, Jun 29 2017
STATUS
approved