[go: up one dir, main page]

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”).

A224317
a(n) = a(n-1) + 3 - a(n-1)!.
0
1, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2, 3, 0, 2
OFFSET
1,2
COMMENTS
a(0) is taken as 1. The sequence remains essentially the same for a(0)=0,1,2,3.
Even though each term is dependent on the previous term, the sequence is repetitive.
FORMULA
a(n) = a(n-1) + 3 - a(n-1)!.
For n > 1, a(n) = (5+4*cos(2*(n+1)*Pi/3) - 2*sqrt(3)*sin(2*(n+1)*Pi/3))/3. - Wesley Ivan Hurt, Sep 27 2017
a(n) = (floor((4*n - 1)/3) + signum(n - 1)) mod 4. - Lechoslaw Ratajczak, Jul 01 2023
EXAMPLE
For n=1, a(1) = a(1-1) + 3 - a(1-1)! = 1 + 3 - 1 = 3.
For n=2, a(2) = a(2-1) + 3 - a(2-1)! = 3 + 3 - 6 = 0.
For n=3, a(3) = a(3-1) + 3 - a(3-1)! = 0 + 3 - 1 = 2.
MATHEMATICA
NestList[#+3-#!&, 1, 90] (* or *) PadRight[{1}, 90, {2, 3, 0}] (* Harvey P. Dale, Apr 23 2015 *)
PROG
(PARI) a(n)=if(n>1, [0, 2, 3][n%3+1], 1) \\ Charles R Greathouse IV, Apr 03 2013
CROSSREFS
Sequence in context: A154574 A119493 A355344 * A375707 A032531 A301430
KEYWORD
nonn,easy
AUTHOR
Mihir Mathur, Apr 03 2013
STATUS
approved