OFFSET
1,2
LINKS
MATHEMATICA
a[1] = a[2] = 1; a[n_] := a[n] = a[n - a[n - 1]] + a[n - a[n - 2]]; Accumulate@ Table[a[n + 1 - a[n]], {n, 72}] (* Michael De Vlieger, Mar 22 2017 *)
PROG
(Scheme)
;; Code for A005185 given under that entry.
;; With memoization-macro definec:
;; As an explicit sum (slower):
;; Implements sum_{i=lowlim..uplim} intfun(i)
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (1+ i) (+ res (intfun i)))))))
(PARI) a(n) = if(n<3, 1, a(n - a(n - 1)) + a(n - a(n - 2)));
for(n=1, 72, print1(sum(k=1, n, a(k + 1 - a(k))), ", ")) \\ Indranil Ghosh, Mar 22 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved