cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A296413 a(1) = a(2) = a(3) = 1, a(4) = 4, a(5) = 3; a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3)) for n > 5.

Original entry on oeis.org

1, 1, 1, 4, 3, 5, 6, 5, 9, 8, 7, 8, 11, 12, 11, 10, 14, 15, 16, 12, 17, 16, 18, 16, 24, 14, 19, 25, 23, 16, 21, 26, 28, 21, 27, 25, 26, 26, 34, 29, 25, 30, 38, 33, 25, 33, 40, 34, 30, 30, 48, 36, 35, 36, 44, 37, 40, 44, 43, 36, 53, 39, 43, 48, 44, 49, 49, 48, 41, 56, 45, 50, 57, 53, 55, 51, 46, 63, 63, 49, 56, 58, 64, 51
Offset: 1

Views

Author

Altug Alkan, Dec 11 2017

Keywords

Comments

For this recurrence (a(n) = a(n-a(n-1)) + a(n-a(n-2)) + a(n-a(n-3))) with five initial conditions, only three options such that 1 <= a(i) <= 5 with 1 <= i <= 5 result in a sequence that does not quickly terminate, of which A278055 is the only well-behaved sequence. The other two sets of initial conditions are (1,1,1,4,3) (which yields this sequence) and (1,1,3,4,4), which yields A292351. This sequence is finite but has a relatively long life: a(509871) = 519293 is its final term since a(509872) refers to a nonpositive index and thus fails to exist; see graph in Links section.

Crossrefs

Programs

  • PARI
    my(q=vector(100)); q[1]=1;q[2]=1;q[3]=1;q[4]=4;q[5]=3; for(n=6, #q, q[n] = q[n-q[n-1]]+q[n-q[n-2]]+q[n-q[n-3]]); q
    
  • Scheme
    ;; With memoization-macro definec.
    (definec (A296413 n) (cond ((< n 1) (error "Dead!")) ((<= n 3) 1) ((= 4 n) 4) ((= 5 n) 3) (else (+ (A296413 (- n (A296413 (- n 1)))) (A296413 (- n (A296413 (- n 2)))) (A296413 (- n (A296413 (- n 3)))))))) ;; Antti Karttunen, Dec 13 2017