OFFSET
1,6
COMMENTS
A jumping flea sequence of order 3 (take a look at the graph and see A104156 for a sequence of order 2).
For n>=1, a(n^2 + (3/2)*(1 - (-1)^n)) = -1; for n>=5, a(n^2 - 2 + (1+(-1)^n)/2) = 0; between zeros there are simple patterns.
LINKS
Harvey P. Dale, Table of n, a(n) for n = 1..1000
MATHEMATICA
RecurrenceTable[{a[1]==a[2]==a[3]==0, a[n]==Abs[a[n-1]+2a[n-2]-a[n-3]]-a[n-2]-1}, a, {n, 90}] (* Harvey P. Dale, Aug 19 2019 *)
PROG
(Magma)
a:= func< n | n lt 4 select 0 else Abs(Self(n-1) +2*Self(n-2) -Self(n-3)) -Self(n-2) -1 >;
[a(n): n in [1..100]]; // G. C. Greubel, Jun 16 2021
(Sage)
@CachedFunction
def a(n): return 0 if (n<4) else abs(a(n-1) +2*a(n-2) -a(n-3)) -a(n-2) -1
[a(n) for n in (1..100)] # a=A156747 # G. C. Greubel, Jun 16 2021
CROSSREFS
KEYWORD
sign
AUTHOR
Benoit Cloitre, Feb 14 2009
STATUS
approved