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.

This page as a plain text file.
%I A140820 #38 Sep 05 2025 15:53:48
%S A140820 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,
%T A140820 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,
%U A140820 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
%N 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.
%H A140820 G. C. Greubel, <a href="/A140820/b140820.txt">Rows n = 0..100 of the triangle, flattened</a>
%e A140820 Triangle begins as:
%e A140820   1;
%e A140820   1, 0;
%e A140820   1, 0, 0;
%e A140820   1, 1, 0, 0;
%e A140820   1, 1, 0, 0, 0;
%e A140820   1, 0, 0, 0, 0, 0;
%e A140820   1, 0, 0, 1, 0, 0, 0;
%e A140820   1, 1, 1, 1, 0, 0, 0, 0;
%e A140820   1, 1, 1, 1, 0, 0, 0, 0, 0;
%e A140820   1, 0, 0, 1, 0, 0, 0, 0, 0, 0;
%e A140820   1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
%e A140820   1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0;
%t A140820 A140820[n_, k_]:= Boole[BitAnd[BitXor[n,BitShiftRight[n,1]], BitXor[k,BitShiftRight[k, 1]]]==0]; (* based on _Kevin Ryde_'s code *)
%t A140820 Table[A140280[n,k], {n,0,12}, {k,0,n}]//Flatten (* _G. C. Greubel_, May 30 2019; Sep 05 2025 *)
%o A140820 (PARI) T(n,k) = !bitand(bitxor(n,n>>1), bitxor(k,k>>1)); \\ _Kevin Ryde_, Jul 13 2020
%o A140820 (Magma)
%o A140820 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
%o A140820 [A140280(n, k): k in [0..n], n in [0..15]]; // _G. C. Greubel_, Sep 05 2025
%o A140820 (SageMath)
%o A140820 def A140820(n,k): return int( (n^^(n>>1)) & (k^^(k>>1)) ==0) # based on _Kevin Ryde_'s code
%o A140820 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
%Y A140820 Cf. A131218.
%K A140820 nonn,tabl,less,changed
%O A140820 0,1
%A A140820 _Roger L. Bagula_ and _Gary W. Adamson_, Oct 17 2008
%E A140820 Edited by _G. C. Greubel_, May 30 2019
%E A140820 New title from _Charlie Neder_, Jun 03 2019
%E A140820 Offset changed by _G. C. Greubel_, Sep 05 2025