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.
%I A292849 #51 Mar 11 2025 16:21:26 %S A292849 1,1,3,1,7,3,7,1,15,7,3,3,5,7,15,1,31,15,7,7,13,3,7,3,31,5,31,7,31,15, %T A292849 31,1,63,31,11,15,7,7,7,7,57,13,3,3,23,7,11,3,21,31,43,5,39,31,7,7,9, %U A292849 31,35,15,21,31,63,1,127,63,23,31,15,11,15,15,29,7 %N A292849 a(n) is the least positive k such that the Hamming weight of k equals the Hamming weight of k*n. %C A292849 The Hamming weight of a number n is given by A000120(n). %C A292849 All terms are odd. %C A292849 Numbers n such that a(n) is not squarefree are 33, 57, 63, 66, 83, 114, 115, 126, 132, 153, 155, ... %C A292849 Numbers n such that a(n) > n are 5, 9, 17, 25, 27, 29, 33, 41, 65, 97, 101, 109, 113, ... %C A292849 a(n) = 1 iff n = 2^i for some i >= 0. %C A292849 a(n) = 3 iff n = A007583(i) * 2^j for some i > 0 and j >= 0. %C A292849 Apparently: %C A292849 - if n < 2^k then a(n) < 2^k, %C A292849 - a(n) = n iff n = A000225(i) for some i > 0. %C A292849 Proof that a(n) < 2^k if n < 2^k (see preceding comment): We can assume that n is not a power of two and take k such that 2^(k-1) < n < 2^k (so that k is the number of binary digits of n). Now, n - 1 and 2^k - n have complementary binary digits, so the binary digits of (2^k - 1)*n = 2^k*(n - 1) + (2^k - n) consist of the k digits of n - 1 followed by the complementary digits. This implies that the number of binary 1's is k, so that (2^k - 1)*n and 2^k - 1 have the same number of 1's and a(n) <= 2^k - 1. - _Pontus von Brömssen_, Jan 01 2021 %C A292849 See also A180012 for the base 10 equivalent sequence. %H A292849 Rémy Sigrist, <a href="/A292849/b292849.txt">Table of n, a(n) for n = 1..10000</a> %H A292849 Altug Alkan, <a href="/A292849/a292849.png">Line graph of n - a(n) for n <= 2^20 + 1</a> %H A292849 Rémy Sigrist, <a href="/A292849/a292849_1.png">Scatterplot of n XOR a(n) for n <= 2^16</a> %F A292849 a((2^m)*n) = a(n) for all m >= 0 and n >= 1. %F A292849 a(2^m + 1) = 2^(m + 1) - 1 for all m >= 0. %F A292849 a(2^m - 1) = 2^m - 1 for all m >= 1. %F A292849 a(2^m) = 1 for all m >= 0. %t A292849 Table[SelectFirst[Range[1, 2^8 + 1, 2], Equal @@ Thread[DigitCount[{#, # n}, 2, 1]] &], {n, 74}] (* _Michael De Vlieger_, Sep 25 2017 *) %o A292849 (PARI) a(n) = forstep(k=1, oo, 2, if (hammingweight(k) == hammingweight(k*n), return (k))) %o A292849 (PARI) a(n) = my(k=1); while ((hammingweight(k)) != hammingweight(k*n), k++); k; %o A292849 (Python) %o A292849 from itertools import count %o A292849 def A292849(n): return next(k for k in count(1) if k.bit_count()==(k*n).bit_count()) # _Chai Wah Wu_, Mar 11 2025 %Y A292849 Cf. A000120, A000225, A007583, A115873, A180012. %K A292849 nonn,base,easy,look %O A292849 1,3 %A A292849 _Rémy Sigrist_ and _Altug Alkan_, Sep 25 2017