login
A287292
a(1) = 1, a(2) = 2; a(n) = a(n-a(n-1)+1) + a(n-a(n-2)-1) for n > 2.
3
1, 2, 3, 3, 4, 5, 5, 5, 7, 6, 8, 8, 8, 9, 10, 10, 10, 12, 10, 13, 13, 11, 15, 14, 15, 16, 16, 16, 17, 17, 18, 19, 19, 19, 20, 20, 22, 20, 23, 22, 23, 23, 23, 24, 24, 28, 24, 25, 29, 25, 29, 30, 29, 31, 30, 30, 32, 32, 32, 33, 33, 33, 35, 34, 36, 36, 36, 37, 38, 38, 38, 39
OFFSET
1,2
MATHEMATICA
a[n_]:= a[n] = If[n <= 2, n, a[n - a[n - 1] + 1] + a[n - a[n - 2] - 1]]; Array[a, 72] (*Michael De Vlieger,May 22 2017 *)
PROG
(PARI) q=vector(10000); q[1]=1; q[2]=2; for(n=3, #q, q[n]=q[n-q[n-1]+1]+q[n-q[n-2]-1]); vector(10000, n, q[n])
(Scheme)
;; An implementation of memoization-macro definec can be found for example in: http://oeis.org/wiki/Memoization
(definec (A287292n) (if (<= n 2) n (+ (A287292(+ 1 (- n (A287292(- n 1))))) (A287292(+ -1 (- n (A287292(- n 2))))))));;Antti Karttunen,May 30 2017
KEYWORD
nonn
AUTHOR
Altug Alkan,May 22 2017
STATUS
approved