[go: up one dir, main page]

login
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.
5
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,2
COMMENTS
Subsidiary sequences: first (A100919) and the last (A100920) occurrences of n.
LINKS
EXAMPLE
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.
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 *)
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Amarnath Murthy, Dec 05 2004
EXTENSIONS
Extended by Ray Chandler, Dec 08 2004
STATUS
approved