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.

A026276 a(n) = a(m) if a(m) has already occurred exactly once and n = a(m) + m + 2, else a(n) = least positive integer that has not yet occurred.

Original entry on oeis.org

1, 2, 3, 1, 4, 2, 5, 3, 6, 7, 4, 8, 9, 5, 10, 11, 6, 12, 7, 13, 14, 8, 15, 9, 16, 17, 10, 18, 11, 19, 20, 12, 21, 22, 13, 23, 14, 24, 25, 15, 26, 27, 16, 28, 17, 29, 30, 18, 31, 32, 19, 33, 20, 34, 35, 21, 36, 22, 37, 38, 23, 39, 40, 24, 41, 25
Offset: 1

Views

Author

Keywords

Comments

From Bob Selcoe, Mar 21 2017: (Start)
The sequence is composed of two unevenly interleaved subsequences B = {1..i} and C = {1..j}:
n: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
B: 1 2 3 - 4 - 5 - 6 7 - 8 9 - 10 11 - 12 - 13
C: - - - 1 - 2 - 3 - - 4 - - 5 - - 6 - 7 -
Terms in C can be derived from B: b(n) = n when n <= 3; when n > 3 and b(n) is not null, then b(n) = c(n+b(n)+2). So for example, c(17) = 6 because b(9) = 6 and 9+6+2 = 17.
b(n) = c(5n/3) as n -> inf.; that is, when a(n) = j first appears, the second appearance approaches a(5n/3) as n -> inf. (End)

Crossrefs

Cf. A009947.

Programs

  • Mathematica
    a = {1}; Do[AppendTo[a, If[n == # + Position[a, #][[1, 1]] + 2, #, If[Length@ # == 0, Max@ a + 1, First@ #] &@ Complement[Range@ Max@ a, a]]] &@ Last@ SelectFirst[Transpose@ {Values@ #, Keys@ #}, Length@ First@ # == 1 &] &@ PositionIndex[a], {n, 2, 66}]; a (* Michael De Vlieger, Mar 22 2017, Version 10 *)