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!)
A143146 a(n) is the smallest positive multiple of n that has the same number of 0's as 1's in its binary representation. 5

%I #24 Jul 11 2022 16:05:10

%S 2,2,9,12,10,12,35,56,9,10,44,12,52,42,135,240,153,180,38,180,42,44,

%T 184,216,50,52,135,56,232,150,527,992,165,170,35,180,37,38,156,240,41,

%U 42,172,44,135,184,141,240,49,50,153,52,212,216,165,56,228,232,177,180

%N a(n) is the smallest positive multiple of n that has the same number of 0's as 1's in its binary representation.

%H Michael S. Branicky, <a href="/A143146/b143146.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Harvey P. Dale)

%F a(n) = n * A351599(n). - _Rémy Sigrist_, Jul 11 2022

%e For n = 7, checking: 7*1 = 7 = 111_2; 7*2 = 14 = 1110_2; 7*3 = 21 = 10101_2; 7*4 = 28 = 11100_2. All of these have two many 1's in binary. But 7*5 = 35 = 100011_2, which has both three 0's and three 1's. So a(7) = 35.

%p a:=proc(n) local b,k: b:=proc(m) convert(m,base,2) end proc: for k while add(b(k*n)[j],j=1..nops(b(k*n))) <> nops(b(k*n))-add(b(k*n)[j],j=1..nops(b(k*n))) do end do: k*n end proc: seq(a(n),n=1..60); # _Emeric Deutsch_, Aug 16 2008

%t spm[n_]:=Module[{k=1},While[DigitCount[k*n,2,0]!=DigitCount[k*n,2,1], k++]; k*n]; Array[spm,60] (* _Harvey P. Dale_, Apr 25 2014 *)

%o (Python)

%o def a(n):

%o m = n

%o b = bin(m)[2:]

%o while len(b) != 2*b.count("1"):

%o m += n

%o b = bin(m)[2:]

%o return m

%o print([a(n) for n in range(1, 61)]) # _Michael S. Branicky_, May 15 2022

%Y Cf. A031443, A143147, A351599.

%K base,nonn

%O 1,1

%A _Leroy Quet_, Jul 27 2008

%E More terms from _Emeric Deutsch_, Aug 16 2008

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 September 2 17:16 EDT 2024. Contains 375614 sequences. (Running on oeis4.)