OFFSET
1,5
COMMENTS
In other words, for n > 0, a(n+1) = a(o(n)) - a(n) where o is the ordinal transform of the sequence.
The sequence has interesting graphical features (see plot in Links section).
LINKS
Rémy Sigrist, Table of n, a(n) for n = 1..25000
Rémy Sigrist, Density plot of the first 2^22 terms
N. J. A. Sloane (in collaboration with Scott R. Shannon), Art and Sequences, Slides of guest lecture in Math 640, Rutgers Univ., Feb 8, 2020. Mentions this sequence.
EXAMPLE
The first terms, alongside their ordinal transform, are:
n a(n) o(n)
-- ---- ----
1 1 1
2 0 1
3 1 2
4 -1 1
5 2 1
6 -1 2
7 1 3
8 0 2
9 0 3
10 1 4
MATHEMATICA
A={1}; For[n=2, n<=76, n++, A=Append[A, Part[A, Count[Table[Part[A, i], {i, 1, n-1}], Part[A, n-1]]]-Part[A, n-1]]]; A (* Joshua Oliver, Nov 26 2019 *)
Nest[Append[#, #[[Count[#, #[[-1]] ] ]] - #[[-1]]] &, {1}, 75] (* Michael De Vlieger, Dec 01 2019 *)
PROG
(PARI) for (n=1, #(a=vector(76)), print1 (a[n]=if (n==1, 1, a[sum(k=1, n-1, a[k]==a[n-1])]-a[n-1])", "))
CROSSREFS
KEYWORD
sign,look
AUTHOR
Rémy Sigrist, Nov 26 2019
STATUS
approved