login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A296209
a(n) = 1 if n is a pentanacci number, 0 otherwise; characteristic function for A001591.
2
1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
OFFSET
0
MATHEMATICA
With[{pn=LinearRecurrence[{1, 1, 1, 1, 1}, {0, 0, 0, 0, 1}, 15]}, Table[ If[ MemberQ[ pn, n], 1, 0], {n, 0, 150}]] (* Harvey P. Dale, Aug 08 2021 *)
PROG
(PARI) A296209(n) = { if(n<=1, return(1)); my(p0=0, p1=0, p2=0, p3=1, p4=1, old_p0); while(n>p4, old_p0=p0; p0=p1; p1=p2; p2=p3; p3=p4; p4=old_p0+p0+p1+p2+p3; ); (n==p4); }
(Scheme)
(define (A296209 n) (let loop ((i 3)) (if (< (A001591 i) n) (loop (+ 1 i)) (if (= (A001591 i) n) 1 0))))
;; This uses memoization-macro definec:
(definec (A001591 n) (cond ((<= n 3) 0) ((= 4 n) 1) (else (+ (A001591 (- n 1)) (A001591 (- n 2)) (A001591 (- n 3)) (A001591 (- n 4)) (A001591 (- n 5))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 22 2017
STATUS
approved