OFFSET
1,1
LINKS
Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from Harvey P. Dale)
FORMULA
a(n) = n * A351599(n). - Rémy Sigrist, Jul 11 2022
EXAMPLE
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.
MAPLE
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
MATHEMATICA
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 *)
PROG
(Python)
def a(n):
m = n
b = bin(m)[2:]
while len(b) != 2*b.count("1"):
m += n
b = bin(m)[2:]
return m
print([a(n) for n in range(1, 61)]) # Michael S. Branicky, May 15 2022
CROSSREFS
KEYWORD
base,nonn
AUTHOR
Leroy Quet, Jul 27 2008
EXTENSIONS
More terms from Emeric Deutsch, Aug 16 2008
STATUS
approved