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.

A100798 n occurs n times, as early as possible subject to the constraint that two successive occurrences of n are separated by at least by n terms.

Original entry on oeis.org

1, 2, 3, 4, 2, 5, 3, 6, 4, 7, 3, 5, 8, 4, 6, 9, 10, 5, 4, 7, 11, 6, 8, 5, 12, 9, 13, 7, 6, 5, 10, 8, 11, 14, 15, 6, 7, 9, 12, 16, 8, 10, 6, 13, 7, 11, 17, 9, 14, 8, 15, 12, 7, 10, 18, 19, 16, 9, 8, 11, 7, 13, 20, 14, 10, 12, 15, 8, 9, 17, 21, 11, 22, 16, 18, 10, 8, 13, 9, 12, 14, 19, 15, 11
Offset: 1

Views

Author

Amarnath Murthy, Dec 05 2004

Keywords

Comments

Subsidiary sequences: first (A100919) and the last (A100920) occurrences of n.

Examples

			Index of the first occurrence of 2 is 2 and that of the second occurrence is 5, separated by a(3) and a(4), two terms.
		

Crossrefs

Programs

  • Mathematica
    mx = 22; lst = cnt = ConstantArray[0, mx + 1]; a = {}; Do[k = Min@Select[Range[mx + 1], lst[[#]] <= n && cnt[[#]] < # &]; AppendTo[a, k]; lst[[k]] = n + k + 1; cnt[[k]]++; If[k > mx, Break[]], {n, mx^2}]; a (* Ivan Neretin, Nov 25 2016 *)

Extensions

Extended by Ray Chandler, Dec 08 2004