%I #81 Aug 21 2023 13:58:52
%S 0,2,1,5,7,3,10,4,13,15,6,18,20,8,23,9,26,28,11,31,12,34,36,14,39,41,
%T 16,44,17,47,49,19,52,54,21,57,22,60,62,24,65,25,68,70,27,73,75,29,78,
%U 30,81,83,32,86,33,89,91,35,94,96,37,99,38,102,104,40,107,109
%N Start with the nonnegative integers; then swap L(k) and U(k) for all k >= 1, where L = A000201, U = A001950 (lower and upper Wythoff sequences).
%C (n,a(n)) are Wythoff pairs: (0,0), (1,2), (3,5), (4,7), ..., where each difference occurs once.
%C Self-inverse when considered as a permutation or function, i.e., a(a(n)) = n. - _Howard A. Landman_, Sep 25 2001
%C If the offset is 1, the sequence can also be obtained by rearranging the natural numbers so that sum of n terms is a multiple of n, or equivalently so that the arithmetic mean of the first n terms is an integer. - _Amarnath Murthy_, Aug 16 2002
%C For n = 1, 2, 3, ..., let p(n)=least natural number not already an a(k), q(n) = n + p(n); then a(p(n)) = q(n), a(q(n)) = p(n). - _Clark Kimberling_
%C Also, indices of powers of 2 in A086482. - _Amarnath Murthy_, Jul 26 2003
%C There is a 7-state Fibonacci automaton (see a002251_1.pdf) that accepts, in parallel, the Zeckendorf representations of n and a(n). - _Jeffrey Shallit_, Jul 14 2023
%D E. R. Berlekamp, J. H. Conway and R. K. Guy, Winning Ways, Academic Press, NY, 2 vols., 1982, see p. 76.
%H T. D. Noe, <a href="/A002251/b002251.txt">Table of n, a(n) for n = 0..10000</a>
%H F. Michel Dekking, Jeffrey Shallit, and N. J. A. Sloane, <a href="https://www.combinatorics.org/ojs/index.php/eljc/article/view/v27i1p52/8039">Queens in exile: non-attacking queens on infinite chess boards</a>, Electronic J. Combin., 27:1 (2020), #P1.52.
%H Eric Duchene, Aviezri S. Fraenkel, Vladimir Gurvich, Nhan Bao Ho, Clark Kimberling, and Urban Larsson, <a href="http://www.wisdom.weizmann.ac.il/~fraenkel/Papers/WythoffWisdomJune62016.pdf">Wythoff Wisdom</a>, 43 pages, no date, unpublished.
%H Eric Duchene, Aviezri S. Fraenkel, Vladimir Gurvich, Nhan Bao Ho, Clark Kimberling, and Urban Larsson, <a href="/A001950/a001950.pdf">Wythoff Wisdom</a>, unpublished, no date [Cached copy, with permission]
%H Alex Meadows and B. Putman, <a href="https://arxiv.org/abs/1606.06819">A New Twist on Wythoff's Game</a>, arXiv preprint arXiv:1606.06819 [math.CO], 2016.
%H Gabriel Nivasch, <a href="http://www.msri.org/people/staff/levy/files/Book56/43nivasch.pdf">More on the Sprague-Grundy function for Wythoff’s game</a>, pages 377-410 in "Games of No Chance 3, MSRI Publications Volume 56, 2009.
%H Jeffrey Shallit, <a href="/A002251/a002251_1.pdf">Automaton for A002251</a>
%H Jeffrey Shallit, <a href="https://arxiv.org/abs/2308.06544">Proving properties of some greedily-defined integer recurrences via automata theory</a>, arXiv:2308.06544 [cs.DM], 2023.
%H R. Silber, <a href="http://www.fq.math.ca/Scanned/15-1/silber2.pdf">Wythoff's Nim and Fibonacci Representations</a>, Fibonacci Quarterly #14 (1977), pp. 85-88.
%H N. J. A. Sloane, <a href="/A002251/a002251.pdf">Scatterplot of first 100 terms</a> [The points are symmetrically placed about the diagonal, although that is hard to see here because the scales on the axes are different]
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F a(n) = A019444(n+1) - 1.
%t With[{n = 42}, {0}~Join~Take[Values@ #, LengthWhile[#, # == 1 &] &@ Differences@ Keys@ #] &@ Sort@ Flatten@ Map[{#1 -> #2, #2 -> #1} & @@ # &, Transpose@ {Array[Floor[# GoldenRatio] &, n], Array[Floor[# GoldenRatio^2] &, n]}]] (* _Michael De Vlieger_, Nov 14 2017 *)
%o (PARI) A002251_upto(N,c=0,A=Vec(0,N))={for(n=1,N, A[n]||(#A<A[n]=n+c++)|| A[n+c]=n); A} \\ The resulting vector starts with A002251[1]=2, a(0)=0 is not included. - _M. F. Hasler_, Nov 27 2019, replacing earlier code from Sep 17 2014
%Y The sequence maps between A000201 and A001950, in that a(A000201(n)) = A001950(n), a(A001950(n)) = A000201(n).
%Y Row 0 of A018219.
%Y Cf. A073869, A342297.
%K nonn,easy,nice
%O 0,2
%A _Michael Kleber_
%E Edited by _Christian G. Bower_, Oct 29 2002