A131218 Array read by antidiagonals: A(n, k) = 1 if and only if the Gray codes for n and k have no bits in common.
1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1
Offset: 0
Examples
Array, A(n, k), begins as: 1, 1, 1, 1, 1, 1, 1, 1, 1, ...; 1, 0, 0, 1, 1, 0, 0, 1, 1, ...; 1, 0, 0, 0, 0, 0, 0, 1, 1, ...; 1, 1, 0, 0, 0, 0, 1, 1, 1, ...; 1, 1, 0, 0, 0, 0, 0, 0, 0, ...; 1, 0, 0, 0, 0, 0, 0, 0, 0, ...; 1, 0, 0, 1, 0, 0, 0, 0, 0, ...; 1, 1, 1, 1, 0, 0, 0, 0, 0, ...; 1, 1, 1, 1, 0, 0, 0, 0, 0, ...; ... Antidiagonals begin as: 1; 1, 1; 1, 0, 1; 1, 0, 0, 1; 1, 1, 0, 1, 1; 1, 1, 0, 0, 1, 1; 1, 0, 0, 0, 0, 0, 1; 1, 0, 0, 0, 0, 0, 0, 1; 1, 1, 0, 0, 0, 0, 0, 1, 1; 1, 1, 1, 1, 0, 0, 1, 1, 1, 1; 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1; 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1; 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1; 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1; 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1; 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1; ...
Links
- G. C. Greubel, Antidiagonals n = 0..100, flattened
Programs
-
Magma
A131218:= func< n,k | BitwiseAnd(BitwiseXor(n, ShiftRight(n, 1)), BitwiseXor(k, ShiftRight(k, 1))) eq 0 select 1 else 0 >; // based on Kevin Ryde's code of A140820 [A131218(n-k,k): k in [0..n], n in [0..15]]; // G. C. Greubel, Sep 04 2025
-
Mathematica
A131218[n_, k_]:= Boole[BitAnd[BitXor[n, BitShiftRight[n,1]], BitXor[k, BitShiftRight[k,1]]]==0]; (* based on Kevin Ryde's code of A140820 *) Table[A131218[n-k, k], {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, Sep 04 2025 *)
-
PARI
A(n, k) = !bitand(bitxor(n, n>>1), bitxor(k, k>>1)); \\ Joerg Arndt, Sep 05 2025
-
SageMath
def A131218(n,k): return int( (n^^(n>>1)) & (k^^(k>>1)) ==0) # based on Kevin Ryde's code of A140820 print(flatten([[A131218(n-k, k) for k in range(n+1)] for n in range(13)])) # G. C. Greubel, Sep 05 2025
Formula
A(n,k) = A(k,n) = A140820(n,k) for k <= n.
Extensions
Edited by and new name from G. C. Greubel, Sep 04 2025