%I #32 Jan 27 2022 21:27:41
%S 0,0,1,0,2,3,4,0,3,2,5,1,6,7,8,0,7,6,9,5,10,11,12,4,13,14,15,16,17,18,
%T 19,0,11,10,16,9,14,13,20,12,21,22,23,24,25,26,27,1,28,29,30,31,32,33,
%U 34,35,36,37,38,39,40,41,42,0,18,17,24,15,22,21,35,9
%N Lexicographically earliest sequence such that, for any distinct i and j, a(i)=a(j) implies (i AND j)=0 (where AND stands for the bitwise AND operator).
%C This sequence is similar to A279119 in the sense that here we check for common ones in binary representation and there we check for common prime factors.
%C By analogy with A275152, this sequence can be seen as a way to tile the first quadrant with fixed disconnected 2-dimensional polyominoes: the (vertical) polyomino corresponding to n is shifted to the right as little as possible so as not to overlap a previous polyomino, and a(n) gives the corresponding number of steps to the right (see illustration in Links section).
%H Rémy Sigrist, <a href="/A279125/b279125.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A279125/a279125.jpg">Illustration of the first terms (by way of polyominos)</a>
%H N. J. A. Sloane and Brady Haran, <a href="https://www.youtube.com/watch?v=j0o-pMIR8uk">Amazing Graphs III</a>, Numberphile video (2019).
%F a(n)=0 iff n belongs to A000079.
%F a(n)=1 iff n belongs to A164346.
%p with(Bits):
%p n:= 100:
%p l:= []:
%p g:=[seq(0, i = 0..n-1)]:
%p for i from 1 to n by 1
%p do
%p a:= 0;
%p while (And(g[a + 1], i)) > 0
%p do
%p a++;
%p end do:
%p g[a + 1] += i;
%p l:= [op(l), a];
%p end do:
%p print(l); # _Reza K Ghazi_, Dec 29 2021
%t n = 100;
%t l = {};
%t g = ConstantArray[0, n];
%t For[i = 0, i < n, i++; a = 0; While[BitAnd[g[[a + 1]], i] > 0, a++];
%t g[[a + 1]] += i;
%t l = Append[l, a]];
%t l (* _Reza K Ghazi_, Dec 29 2021 *)
%o (PARI) g = vector(72); for (n=1, #g, a = 0; while (bitand(g[a+1],n)>0, a++); g[a+1] += n; print1 (a", "))
%o (Python)
%o n = 100
%o g = n * [0]
%o for i in range(1, n + 1):
%o a = 0
%o while g[a] & i:
%o a += 1
%o g[a] += i
%o print(a, end=', ') # _Reza K Ghazi_, Dec 29 2021
%Y Cf. A000079, A164346, A275152, A279119.
%K nonn,base,look
%O 1,5
%A _Rémy Sigrist_, Dec 06 2016
|