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.

A003986 Table T(n,k) = n OR k read by antidiagonals.

This page as a plain text file.
%I A003986 #38 Jan 17 2023 09:58:05
%S A003986 0,1,1,2,1,2,3,3,3,3,4,3,2,3,4,5,5,3,3,5,5,6,5,6,3,6,5,6,7,7,7,7,7,7,
%T A003986 7,7,8,7,6,7,4,7,6,7,8,9,9,7,7,5,5,7,7,9,9,10,9,10,7,6,5,6,7,10,9,10,
%U A003986 11,11,11,11,7,7,7,7,11,11,11,11,12,11,10,11,12,7,6,7,12,11,10,11,12,13,13,11
%N A003986 Table T(n,k) = n OR k read by antidiagonals.
%H A003986 T. D. Noe, <a href="/A003986/b003986.txt">Rows n=0..100 of triangle, flattened</a>
%F A003986 T(x,y) = T(y,x) = A080098(x,y). - _R. J. Mathar_, May 28 2011
%e A003986 The upper left corner of the array starts in row x=0 with columns y>=0 as:
%e A003986    0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, ...
%e A003986    1,  1,  3,  3,  5,  5,  7,  7,  9,  9, 11, 11, 13, ...
%e A003986    2,  3,  2,  3,  6,  7,  6,  7, 10, 11, 10, 11, 14, ...
%e A003986    3,  3,  3,  3,  7,  7,  7,  7, 11, 11, 11, 11, 15, ...
%e A003986    4,  5,  6,  7,  4,  5,  6,  7, 12, 13, 14, 15, 12, ...
%e A003986    5,  5,  7,  7,  5,  5,  7,  7, 13, 13, 15, 15, 13, ...
%e A003986    6,  7,  6,  7,  6,  7,  6,  7, 14, 15, 14, 15, 14, ...
%e A003986    7,  7,  7,  7,  7,  7,  7,  7, 15, 15, 15, 15, 15, ...
%e A003986    8,  9, 10, 11, 12, 13, 14, 15,  8,  9, 10, 11, 12, ...
%e A003986    9,  9, 11, 11, 13, 13, 15, 15,  9,  9, 11, 11, 13, ...
%e A003986   10, 11, 10, 11, 14, 15, 14, 15, 10, 11, 10, 11, 14, ...
%p A003986 read("transforms") ;
%p A003986 A003986 := proc(x,y) ORnos(x,y) ;end proc:
%p A003986 for d from 0 to 12 do for x from 0 to d do printf("%d,", A003986(x,d-x)) ; end do: end do: # _R. J. Mathar_, May 28 2011
%t A003986 Table[BitOr[k, n - k], {n, 0, 20}, {k, 0, n}] //Flatten (* _Indranil Ghosh_, Apr 01 2017 *)
%o A003986 (Haskell)
%o A003986 import Data.Bits ((.|.))
%o A003986 a003986 n k = (n - k) .|. k :: Int
%o A003986 a003986_row n = map (a003986 n) [0..n]
%o A003986 a003986_tabl = map a003986_row [0..]
%o A003986 -- _Reinhard Zumkeller_, Aug 05 2014
%o A003986 (PARI)
%o A003986 tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitor(k, n - k), ", "); ); print(); ); };
%o A003986 tabl(20) \\ _Indranil Ghosh_, Apr 01 2017
%o A003986 (Python)
%o A003986 for n in range(21):
%o A003986     print([k|(n - k) for k in range(n + 1)])
%o A003986 # _Indranil Ghosh_, Apr 01 2017
%o A003986 (C)
%o A003986 #include <stdio.h>
%o A003986 int main()
%o A003986 {
%o A003986 int n, k;
%o A003986 for (n=0; n<=20; n++){
%o A003986     for(k=0; k<=n; k++){
%o A003986         printf("%d, ", (k|(n - k)));
%o A003986     }
%o A003986     printf("\n");
%o A003986 }
%o A003986 return 0;
%o A003986 } /* _Indranil Ghosh_, Apr 01 2017 */
%Y A003986 Cf. A003987 (XOR) and A004198 (AND). Cf. also A075173, A075175.
%Y A003986 Antidiagonal sums are in A006583.
%K A003986 tabl,nonn,look
%O A003986 0,4
%A A003986 _Marc LeBrun_
%E A003986 Name edited by _Michel Marcus_, Jan 17 2023