login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A003986 Table T(n,k) = n OR k read by antidiagonals. 81

%I #38 Jan 17 2023 09:58:05

%S 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 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 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 Table T(n,k) = n OR k read by antidiagonals.

%H T. D. Noe, <a href="/A003986/b003986.txt">Rows n=0..100 of triangle, flattened</a>

%F T(x,y) = T(y,x) = A080098(x,y). - _R. J. Mathar_, May 28 2011

%e The upper left corner of the array starts in row x=0 with columns y>=0 as:

%e 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, ...

%e 1, 1, 3, 3, 5, 5, 7, 7, 9, 9, 11, 11, 13, ...

%e 2, 3, 2, 3, 6, 7, 6, 7, 10, 11, 10, 11, 14, ...

%e 3, 3, 3, 3, 7, 7, 7, 7, 11, 11, 11, 11, 15, ...

%e 4, 5, 6, 7, 4, 5, 6, 7, 12, 13, 14, 15, 12, ...

%e 5, 5, 7, 7, 5, 5, 7, 7, 13, 13, 15, 15, 13, ...

%e 6, 7, 6, 7, 6, 7, 6, 7, 14, 15, 14, 15, 14, ...

%e 7, 7, 7, 7, 7, 7, 7, 7, 15, 15, 15, 15, 15, ...

%e 8, 9, 10, 11, 12, 13, 14, 15, 8, 9, 10, 11, 12, ...

%e 9, 9, 11, 11, 13, 13, 15, 15, 9, 9, 11, 11, 13, ...

%e 10, 11, 10, 11, 14, 15, 14, 15, 10, 11, 10, 11, 14, ...

%p read("transforms") ;

%p A003986 := proc(x,y) ORnos(x,y) ;end proc:

%p 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 Table[BitOr[k, n - k], {n, 0, 20}, {k, 0, n}] //Flatten (* _Indranil Ghosh_, Apr 01 2017 *)

%o (Haskell)

%o import Data.Bits ((.|.))

%o a003986 n k = (n - k) .|. k :: Int

%o a003986_row n = map (a003986 n) [0..n]

%o a003986_tabl = map a003986_row [0..]

%o -- _Reinhard Zumkeller_, Aug 05 2014

%o (PARI)

%o tabl(nn) = {for(n=0, nn, for(k=0, n, print1(bitor(k, n - k), ", "); ); print(); ); };

%o tabl(20) \\ _Indranil Ghosh_, Apr 01 2017

%o (Python)

%o for n in range(21):

%o print([k|(n - k) for k in range(n + 1)])

%o # _Indranil Ghosh_, Apr 01 2017

%o (C)

%o #include <stdio.h>

%o int main()

%o {

%o int n, k;

%o for (n=0; n<=20; n++){

%o for(k=0; k<=n; k++){

%o printf("%d, ", (k|(n - k)));

%o }

%o printf("\n");

%o }

%o return 0;

%o } /* _Indranil Ghosh_, Apr 01 2017 */

%Y Cf. A003987 (XOR) and A004198 (AND). Cf. also A075173, A075175.

%Y Antidiagonal sums are in A006583.

%K tabl,nonn,look

%O 0,4

%A _Marc LeBrun_

%E Name edited by _Michel Marcus_, Jan 17 2023

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 11:40 EDT 2024. Contains 371936 sequences. (Running on oeis4.)