login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A337014 a(1) = 0 and for n > 1, a(n+1) = (k(n) - a(n))*(-1)^(n+1) where k(n) is the number of terms equal to a(n) among the first n terms. 1
0, 1, 0, 2, 1, 1, -2, 3, 2, 0, -3, 4, 3, -1, -2, 4, 2, 1, -3, 5, 4, -1, -3, 6, 5, -3, -7, 8, 7, -6, -7, 9, 8, -6, -8, 9, 7, -5, -6, 9, 6, -4, -5, 7, 4, 0, -4, 6, 3, 0, -5, 8, 5, -2, -5, 9, 5, -1, -4, 7, 3, 1, -4, 8, 4, 1, -5, 10, 9, -4, -9, 10, 8, -3, -8, 10, 7, -2, -6, 10, 6, -2, -7 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,4

COMMENTS

The graph of the sequence shows interesting, "Christmas tree"-like shapes.

LINKS

Bence Bernáth, Table of n, a(n) for n = 1..10000

EXAMPLE

For n = 4, a(4) = 2, which appeared only once before, so a(5)=(1-2)*(-1)^5 = 1.

MATHEMATICA

a = {0}; Do[AppendTo[a, (-1)^k*(Count[a, a[[-1]]] - a[[-1]])], {k, 0, 81}]; a (* Amiram Eldar, Nov 21 2020 *)

PROG

(MATLAB)

length=10000;

sequence(1)=0;

for n=2:1:length

     sequence(n)=((nnz(sequence==sequence(end)))-(sequence(n-1)))*(-1)^n;

end

(PARI) { for (n=1, #a=vector(83), print1(a[n]=if (n==1, 0, k=sum(k=1, n-1, a[k]==a[n-1]); (k-a[n-1])*(-1)^n) ", ")) } \\ Rémy Sigrist, Nov 22 2020

CROSSREFS

Cf. A337835, A329985.

Sequence in context: A029254 A063740 A072782 * A122563 A204030 A234503

Adjacent sequences:  A337011 A337012 A337013 * A337015 A337016 A337017

KEYWORD

sign,look

AUTHOR

Bence Bernáth, Nov 21 2020

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 7 19:13 EST 2021. Contains 341928 sequences. (Running on oeis4.)