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.

A335999 a(1) = 1; for n >= 2, a(n) = least positive integer not in {a(1),..., a(n-1), b(1),...,b(n-1)}, where for n >=1, b(n) = n + 2 + least positive integer not in {a(1),..., a(n-1), a(n), b(1),...,b(n-1)}.

Original entry on oeis.org

1, 2, 3, 4, 6, 8, 10, 11, 13, 14, 16, 17, 19, 21, 22, 24, 26, 27, 29, 31, 32, 34, 35, 37, 39, 40, 42, 43, 45, 47, 48, 50, 51, 53, 55, 56, 58, 60, 61, 63, 64, 66, 68, 69, 71, 73, 74, 76, 77, 79, 81, 82, 84, 86, 87, 89, 90, 92, 94, 95, 97, 98, 100, 102, 103
Offset: 1

Views

Author

Clark Kimberling, Jul 16 2020

Keywords

Comments

In general, let u(1) = 1, and let k be a positive integer. Define u(n) = least positive integer not in {u(1),..., u(n-1), v(1),...,v(n-1)} and v(n) = n - 1 + k + least positive integer not in {u(1),..., u(n-1), u(n), v(1),...,v(n-1)}. As sets, (u(n)) and (v(n)) are disjoint. If k >= -1, let a(n) = u(n) and b(n) = v(n) for all n >= 1, but if k <= -2, let a(n) = u(n) - k + 1 and b(n) = v(n) - k - 1 for all n >= 1. Then every positive integer is in exactly one of the sequences (a(n)) and (b(n)). The difference sequence of (a(n)) consists of 1's and 2's; the difference sequence of (b(n)) consists of 2's and 3's.
****
Guide to related sequences:
k sequences (a(n)) and (b(n))
0 A000201 and A001950 (lower and upper Wythoff sequences)

Examples

			a(1) = 1; b(1) = 1+2+2 = 5
a(2) = 2; b(2) = 2+2+3 = 7
a(3) = 3; b(3) = 3+2+4 = 9
a(4) = 4; b(4) = 4+2+6 = 12
		

Crossrefs

Cf. A336008.

Programs

  • Mathematica
    mex[list_, start_] := (NestWhile[# + 1 &, start, MemberQ[list, #] &]);
    {a, b} = {{1}, {}}; k = 3;
    Do[AppendTo[b, Length[b] + k + mex[Flatten[{a, b}], Last[a]]];
    AppendTo[a, mex[Flatten[{a, b}], Last[a]]], {150}]
    a  (* A335999 *)
    b  (* A336008 *)
    (* Peter J. C. Moses, Jul 13 2020 *)