cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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
Offset: 1

Views

Author

Neal Gersh Tolunsky, Jan 11 2023

Keywords

Comments

A new number is always followed by a 2.

Examples

			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.
		

Crossrefs

Cf. A358921.

Programs

  • 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 *)
  • 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