%I #13 Nov 03 2020 03:24:21
%S 0,1,2,4,3,5,6,8,7,9,11,13,16,10,17,12,18,20,14,21,24,19,28,32,15,25,
%T 22,33,23,36,26,37,27,29,34,64,30,48,31,41,65,35,68,38,44,39,52,45,54,
%U 69,40,66,49,51,53,46,80,42,81,43,73,47,84,50,72,55,57,67
%N Lexicographically earliest sequence of distinct nonnegative terms such that for any n >= 0, a(n) AND a(n+1) is a square (where AND denotes the bitwise AND operator).
%C This sequence is a permutation of the nonnegative integers with inverse A334672:
%C - we can always extend the sequence with a power of 4,
%C - eventually every power of 4 appears in the sequence,
%C - a power of 4 is followed by the least value not yet in the sequence,
%C - so eventually every integer will appear.
%H Rémy Sigrist, <a href="/A338500/b338500.txt">Table of n, a(n) for n = 0..10000</a>
%H Rémy Sigrist, <a href="/A338500/a338500.gp.txt">PARI program for A338500</a>
%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e The first terms, alongside a(n) AND a(n+1), are:
%e n a(n) a(n) AND a(n+1)
%e -- ---- ---------------
%e 0 0 0^2
%e 1 1 0^2
%e 2 2 0^2
%e 3 4 0^2
%e 4 3 1^2
%e 5 5 2^2
%e 6 6 0^2
%e 7 8 0^2
%e 8 7 1^2
%e 9 9 3^2
%e 10 11 3^2
%e 11 13 0^2
%e 12 16 0^2
%o (PARI) See Links section.
%Y Cf. A334672 (inverse), A335615, A338501.
%K nonn,base
%O 0,3
%A _Rémy Sigrist_, Oct 31 2020