login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A309035 If a(n) is not a term of a(0),...,a(n-1), then a(n+1) = n - m, where m is the most recent time that some new value a(m) appeared for the first time; otherwise a(n+1) is the number of terms equal to a(n) in a(0),...,a(n-1). Start with a(0)=0, a(1)=0. 2
0, 0, 1, 2, 1, 1, 2, 1, 3, 5, 1, 4, 2, 2, 3, 1, 5, 1, 6, 7, 1, 7, 1, 8, 4, 1, 9, 3, 2, 4, 2, 5, 2, 6, 1, 10, 9, 1, 11, 3, 3, 4, 3, 5, 3, 6, 2, 7, 2, 8, 1, 12, 13, 1, 13, 1, 14, 4, 4, 5, 4, 6, 3, 7, 3, 8, 2, 9, 2, 10, 1, 15, 15, 1, 16, 3, 9, 3, 10, 2, 11, 1, 17, 8, 3, 11, 2, 12, 1, 18, 7, 4, 7, 5, 5, 6, 4, 8, 4, 9, 4 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,4
COMMENTS
In other words, if the last term a(n) has not appeared previously, take the difference between its index n and the lowest index m of the last term to appear for the first time to obtain the next term. Otherwise, the next term is the number of terms equal to a(n) in a(0),...,a(n-1).
LINKS
EXAMPLE
a(0)=0 (given).
a(1)=0 (given).
a(2)=1: a(1)=0 is a term of a(0..0), therefore a(2) = number of terms=0 in a(0..0) = 1.
a(3)=2: a(2)=1 is not a term of a(0..1), first appearance of a new term is at a(0), therefore a(3) = 2 - 0 = 2.
a(4)=1: a(3)=2 is not a term of a(0..2), first appearance of a new term is at a(2), therefore: 3 - 2 = 1.
a(5)=1: a(4)=1 is a term of a(0..3), therefore a(5) = Number of terms=1 in a(0..3) = 1.
a(6)=2: a(5)=1 is a term of a(0..4), therefore a(6) = Number of terms=1 in a(0..4) = 2.
a(7)=1: a(6)=2 is a term of a(0..5), therefore a(7) = Number of terms=2 in a(0..5) = 1.
a(8)=3: a(7)=1 is a term of a(0..6), therefore a(8) = Number of terms=1 in a(0..6) = 3.
a(9)=5: a(8)=3 is not a term of a(0..7), first appearance of a new term is at a(3), therefore: 8 - 3 = 5.
a(10)=1: a(9)=5 is not a term of a(0..8), first appearance of a new term is at a(8), therefore: 9 - 8 = 1.
PROG
(PARI) lista(NN) = {v = vector(NN); m=0; v[1]=0; v[2]=1; for(k=2, NN-1, v[k+1]=sum(j=1, k-1, v[j]==v[k]); if(v[k+1]==0, v[k+1]=k-m; m=k)); print1(0); for(i=1, NN, print1(", ", v[i])); } \\ Jinyuan Wang, Aug 04 2019
CROSSREFS
Similar in spirit to A181391. - N. J. A. Sloane, Aug 26 2019
Sequence in context: A233324 A268679 A128807 * A071628 A033809 A046067
KEYWORD
nonn
AUTHOR
Marc Morgenegg, Jul 08 2019
EXTENSIONS
More terms from Jinyuan Wang, Aug 04 2019
STATUS
approved

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 8 15:21 EDT 2024. Contains 374155 sequences. (Running on oeis4.)