%I #15 Dec 18 2017 22:49:51
%S 2,2,2,4,5,5,6,6,8,10,9,8,11,12,12,13,14,14,15,15,16,17,17,18,18,20,
%T 22,21,20,24,25,20,25,28,28,21,29,32,30,25,30,30,36,30,32,35,34,36,35,
%U 37,37,38,38,40,40,40,42,41,43,43,43,45,44,46,46,47,47,49,49,49,51,50,52,52,52,54,53,56,55,58,55,62,55
%N a(1) = a(2) = a(3) = 2, a(4) = 4, a(5) = a(6) = 5; a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)) for n > 6.
%H Altug Alkan, <a href="/A296690/b296690.txt">Table of n, a(n) for n = 1..10000</a>
%H Altug Alkan, <a href="/A296690/a296690.png">Scatterplot of a(n) for n <= 500000</a>
%p a:= proc(n) option remember; procname(n-procname(n-1))+procname(n-procname(n-2))+procname(n-procname(n-3)) end proc:
%p a(1):= 2: a(2):= 2: a(3):= 2: a(4):= 4: a(5):= 5: a(6):= 5:
%p map(a, [$1..100]); # after _Robert Israel_ at A296440
%t a[n_] := a[n] = If[n<7, {2, 2, 2, 4, 5, 5}[[n]], a[n - a[n-1]] + a[n - a[n-2]] + a[n - a[n-3]]]; Array[a, 100] (* after _Giovanni Resta_ at A296440 *)
%o (PARI) q=vector(10^5); q[1]=2; q[2]=2; q[3]=2; q[4]=4; q[5]=5; q[6]=5; for(n=7, #q, q[n] = q[n-q[n-1]]+q[n-q[n-2]]+q[n-q[n-3]]); q
%o (Scheme) (definec (A296690 n) (cond ((<= n 3) 2) ((<= n 5) n) ((= n 6) 5) (else (+ (A296690 (- n (A296690 (- n 1)))) (A296690 (- n (A296690 (- n 2)))) (A296690 (- n (A296690 (- n 3)))))))) ;; _Antti Karttunen_, Dec 18 2017
%Y Cf. A005185, A278055, A284644, A292351, A296413, A296421, A296440, A296518.
%K nonn,look
%O 1,1
%A _Altug Alkan_, Dec 18 2017