Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #25 Jul 13 2017 21:51:54
%S 1,2,3,2,2,4,4,4,4,6,8,8,6,8,8,8,8,12,16,12,12,16,16,12,14,16,16,16,
%T 16,16,16,16,16,20,24,20,20,24,24,20,24,28,28,24,24,28,32,28,28,32,32,
%U 28,32,32,32,28,32,32,32,32,32,32,32,32,32,36,40,36,36,40,40,36,40,44,44,40,40,48,48,44,44,52,48
%N a(1) = 1, a(2) = a(4) = a(5) = 2, a(3) = 3, a(n) = a(a(n-1)) + a(a(n-a(n-1)) + a(n-a(n-2))) for n > 5.
%H Altug Alkan, <a href="/A287707/b287707.txt">Table of n, a(n) for n = 1..10000</a>
%H Altug Alkan, <a href="/A287707/a287707_2.png">Plot of a(n)-n/2</a>
%H Indranil Ghosh, <a href="/A287707/a287707.txt">Python program to compute the sequence</a>
%H <a href="/index/Ho#Hofstadter">Index entries for Hofstadter-type sequences</a>
%p N:= 2^10: # to get a(1) to a(N)
%p C[1]:= 1:
%p C[2]:= 2:
%p C[3]:= 3:
%p C[4]:= 2:
%p C[5]:= 2:
%p for n from 6 to N do
%p C[n]:= C[C[n-1]] + C[C[n-C[n-1]] + C[n-C[n-2]]];
%p od:
%p S:=seq(C[n], n=1..N);
%o (Scheme)
%o ;; An implementation of memoization-macro definec can be found for example in: http://oeis.org/wiki/Memoization
%o (definec (A287707 n) (cond ((or (= 1 n) (= 3 n)) n) ((<= n 5) 2) (else (+ (A287707 (A287707 (- n 1))) (A287707 (+ (A287707 (- n (A287707 (- n 1)))) (A287707 (- n (A287707 (- n 2)))))))))) ;; _Antti Karttunen_, May 31 2017
%Y Cf. A004001, A005185, A287654.
%K nonn
%O 1,2
%A _Altug Alkan_, May 30 2017