cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A140820 Triangle read by rows: T(n,k) = 1 if and only if the Gray codes for n and k have no bits in common.

Original entry on oeis.org

1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0
Offset: 0

Views

Author

Roger L. Bagula and Gary W. Adamson, Oct 17 2008

Keywords

Examples

			Triangle begins as:
  1;
  1, 0;
  1, 0, 0;
  1, 1, 0, 0;
  1, 1, 0, 0, 0;
  1, 0, 0, 0, 0, 0;
  1, 0, 0, 1, 0, 0, 0;
  1, 1, 1, 1, 0, 0, 0, 0;
  1, 1, 1, 1, 0, 0, 0, 0, 0;
  1, 0, 0, 1, 0, 0, 0, 0, 0, 0;
  1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
		

Crossrefs

Cf. A131218.

Programs

  • Magma
    A140280:= 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
    [A140280(n, k): k in [0..n], n in [0..15]]; // G. C. Greubel, Sep 05 2025
    
  • Mathematica
    A140820[n_, k_]:= Boole[BitAnd[BitXor[n,BitShiftRight[n,1]], BitXor[k,BitShiftRight[k, 1]]]==0]; (* based on Kevin Ryde's code *)
    Table[A140280[n,k], {n,0,12}, {k,0,n}]//Flatten (* G. C. Greubel, May 30 2019; Sep 05 2025 *)
  • PARI
    T(n,k) = !bitand(bitxor(n,n>>1), bitxor(k,k>>1)); \\ Kevin Ryde, Jul 13 2020
    
  • SageMath
    def A140820(n,k): return int( (n^^(n>>1)) & (k^^(k>>1)) ==0) # based on Kevin Ryde's code
    print(flatten([[A140820(n, k) for k in range(n+1)] for n in range(16)])) # G. C. Greubel, May 30 2019; Sep 05 2025

Extensions

Edited by G. C. Greubel, May 30 2019
New title from Charlie Neder, Jun 03 2019
Offset changed by G. C. Greubel, Sep 05 2025