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

 Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 59th year, we have over 358,000 sequences, and we’ve crossed 10,300 citations (which often say “discovered thanks to the OEIS”). Other ways to Give
 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A343852 a(n) is the least k > 0 such that the binary expansions of k and of n + k have the same numbers of 0's and of 1's. 2
 5, 10, 9, 20, 21, 18, 17, 40, 19, 42, 38, 36, 37, 34, 33, 80, 35, 38, 37, 84, 35, 76, 74, 72, 73, 74, 70, 68, 69, 66, 65, 160, 67, 70, 69, 76, 67, 74, 73, 168, 75, 70, 69, 152, 67, 148, 146, 144, 71, 146, 145, 148, 140, 140, 138, 136, 137, 138, 134, 132, 133 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1,1 COMMENTS This is the binary analog of A343888. LINKS Rémy Sigrist, Table of n, a(n) for n = 1..8191 FORMULA a(n) <= A004757(n). EXAMPLE The first terms, alongside the binary expansions of a(n) and of n + a(n), are: n a(n) bin(a(n)) bin(n+a(n)) -- ---- --------- ----------- 1 5 101 110 2 10 1010 1100 3 9 1001 1100 4 20 10100 11000 5 21 10101 11010 6 18 10010 11000 7 17 10001 11000 8 40 101000 110000 9 19 10011 11100 10 42 101010 110100 11 38 100110 110001 12 36 100100 110000 13 37 100101 110010 14 34 100010 110000 15 33 100001 110000 PROG (PARI) a(n) = { for (k=1, oo, if (#binary(k)==#binary(n+k) && hammingweight(k)==hammingweight(n+k), return (k))) } (Python) def a(n): k = 1 while k.bit_length() != (n+k).bit_length() or bin(k).count('1') != bin(n+k).count('1'): k += 1 return k print([a(n) for n in range(1, 62)]) # Michael S. Branicky, May 04 2021 CROSSREFS Cf. A000120, A004757, A023416, A293198, A343888. Sequence in context: A109360 A141622 A144136 * A198286 A001483 A173679 Adjacent sequences: A343849 A343850 A343851 * A343853 A343854 A343855 KEYWORD nonn,base AUTHOR Rémy Sigrist, May 03 2021 STATUS approved

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.

Last modified November 27 19:48 EST 2022. Contains 358406 sequences. (Running on oeis4.)