The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
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!)
A359728 a(1) = 1; a(n) is the smallest positive number not among the first k terms where k is the number of times a(n-1) has occurred. 1
1, 2, 2, 3, 2, 3, 3, 3, 4, 2, 4, 3, 4, 3, 4, 4, 4, 4, 4, 4, 5, 2, 4, 5, 3, 4, 5, 3, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 2, 4, 5, 6, 3, 5, 6, 3, 5, 6, 4, 5, 6, 4, 5, 6, 4, 6, 4, 6, 4, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
COMMENTS
A new number is always followed by a 2.
LINKS
EXAMPLE
a(4) is 3 because the previous term (2) appears two times; we therefore look at the first 2 terms (1,2). 3 is the smallest number not among them, so a(4) is 3.
a(21) is 5: We see that a(20)=4 appears 9 times; the smallest number not among the first 9 terms (1,2,2,3,2,3,3,3,4) is 5.
MATHEMATICA
K = {1}; While[Length@K < 87, T = Take[K, Count[K, Last@K]]; i = 1; While[MemberQ[T, i], i++]; AppendTo[K, i]]; Print[K] (* Samuel Harkness, Mar 12 2023 *)
PROG
(PARI) lista(nn) = my(va=vector(nn)); va[1] = 1; for (n=2, nn, my(k=#select(x->(x==va[n-1]), va)); my(vb=Vec(va, k), m); for(j=1, vecmax(vb)+1, if (! #select(x->(x==j), vb), m=j; break)); va[n] = m; ); va; \\ Michel Marcus, Jan 13 2023
CROSSREFS
Cf. A358921.
Sequence in context: A358550 A126071 A338292 * A217865 A185166 A276555
KEYWORD
nonn
AUTHOR
Neal Gersh Tolunsky, Jan 11 2023
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 May 27 21:52 EDT 2024. Contains 372882 sequences. (Running on oeis4.)