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

A072175
a(1)=1, a(2)=2, a(n) = a(n-1) + 1 - 2*sign(a(n-2)) for n>2.
0
1, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3, 2, 1, 0, -1, 0, 3, 4, 3
OFFSET
0,2
COMMENTS
The sequence has period 8 except for the first term.
REFERENCES
Marius-F. Danca, Contributions to the Theory of Discontinuous Dynamical System, Thesis 2002, University Babes-Bolyai, Cluj, Romania, page 5
FORMULA
a(n) = a(n-1)-a(n-2)+a(n-3)-a(n-4)+a(n-5)-a(n-6)+a(n-7). - Wesley Ivan Hurt, May 26 2024
EXAMPLE
a(3) = 2+1-2*sign(1) = 1.
a(4) = 1+1-2*sign(2) = 0.
MATHEMATICA
a[1]=1; a[2]=2; a[n_] := a[n]=a[n-1]+1-2Sign[a[n-2]]
CROSSREFS
Sequence in context: A123022 A072943 A372596 * A280712 A363926 A306607
KEYWORD
sign,easy,less
AUTHOR
Roger L. Bagula, Jun 29 2002
EXTENSIONS
Edited by Dean Hickerson, Jul 31 2002
STATUS
approved