%I #41 May 10 2022 12:47:47
%S 0,1,2,4,8,3,16,12,32,17,6,40,64,5,10,48,65,14,128,33,18,68,9,34,20,
%T 72,35,132,24,66,36,25,130,96,13,144,98,256,21,42,192,257,22,104,129,
%U 258,28,97,384,26,37,320,136,7,80,160,11,84,288,131,76,272,161,70,264,49,134,328,512,19,44,448,513,30,224,768,15,112,640,259,52,200,514,53
%N a(0)=0, a(1)=1; thereafter a(n) = smallest nonnegative integer not among the earlier terms of the sequence such that a(n) and a(n-2) have no common 1-bits in their binary representations and also a(n) and a(n-1) have no common 1-bits in their binary representations.
%C A set-theory analog of A084937.
%C Conjecture: This is a permutation of the nonnegative numbers.
%H Michael De Vlieger, <a href="/A353709/b353709.txt">Table of n, a(n) for n = 0..16384</a>
%H Walter Trump, <a href="/A353709/a353709.txt">Table of n, a(n) for n = 0..10^6</a>
%H Walter Trump, <a href="/A353709/a353709.png">Log-log plot of first 2^24 terms</a>
%p read(transforms) : # ANDnos def'd here
%p A353709 := proc(n)
%p option remember;
%p local c, i, known ;
%p if n <= 2 then
%p n;
%p else
%p for c from 1 do
%p known := false ;
%p for i from 1 to n-1 do
%p if procname(i) = c then
%p known := true;
%p break ;
%p end if;
%p end do:
%p if not known and ANDnos(c, procname(n-2)) = 0 and ANDnos(c, procname(n-1)) = 0 then
%p return c;
%p end if;
%p end do:
%p end if;
%p end proc: # Following R. J. Mathar's program for A109812.
%p [seq(A353709(n), n=0..256)] ;
%p # second Maple program:
%p b:= proc() false end: t:= 2:
%p a:= proc(n) option remember; global t; local k; if n<2 then n
%p else for k from t while b(k) or Bits[And](k, a(n-2))>0
%p or Bits[And](k, a(n-1))>0 do od; b(k):=true;
%p while b(t) do t:=t+1 od; k fi
%p end:
%p seq(a(n), n=0..100); # _Alois P. Heinz_, May 06 2022
%t nn = 83; c[_] = -1; a[0] = c[0] = 0; a[1] = c[1] = 1; u = 2; Do[k = u; While[Nand[c[k] == -1, BitAnd[a[n - 1], k] == 0, BitAnd[a[n - 2], k] == 0], k++]; Set[{a[n], c[k]}, {k, n}]; If[k == u, While[c[u] > -1, u++]], {n, 2, nn}], n]; Array[a, nn+1, 0] (* _Michael De Vlieger_, May 06 2022 *)
%o (Python)
%o from itertools import count, islice
%o def A353709_gen(): # generator of terms
%o s, a, b, c, ab = {0,1}, 0, 1, 2, 1
%o yield from (0,1)
%o while True:
%o for n in count(c):
%o if not (n & ab or n in s):
%o yield n
%o a, b = b, n
%o ab = a|b
%o s.add(n)
%o while c in s:
%o c += 1
%o break
%o A353709_list = list(islice(A353709_gen(),20)) # _Chai Wah Wu_, May 07 2022
%Y Cf. A084937 (number theory analog), A109812, A121216, A353405 (powers of 2), A353708, A353710, A353715 and A353716 (a(n)+a(n+1)), A353717 (inverse), A353718, A353719 (primes), A353720 and A353721 (Records).
%Y For the numbers that are the slowest to appear see A353723 and A353722.
%K nonn,base
%O 0,3
%A _N. J. A. Sloane_, May 06 2022
|