Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #15 Dec 04 2022 13:05:29
%S 2,-1,147,-1,10,12,3745,-1,34587,8990,539,2364,156,728,135,-1,153,180,
%T 38,180,42,44,805,216,50,52,3969,56,62089,62850,1022721,-1,8515815,
%U 2158830,134715,553212,35557,34428,8814,144120,2296,8442,2107,8668,2205,2254
%N Least multiple m of n such that both m and m/n belong to A031443, or -1 if there is no such m.
%C Clearly a(2^i)=-1 for i>0, since x*2^i has more 0's than x does. I do not know that there is such an m for all n, although it exists up to n=513.
%H Rémy Sigrist, <a href="/A358858/b358858.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A358858/a358858.gp.txt">PARI program</a>
%F a(n) = n*A358857(n) unless a(n) = -1. - _Pontus von Brömssen_, Dec 03 2022
%e For n = 3 both 147 and 147/3=49 are in A031443.
%o (Python)
%o from itertools import count
%o from sympy.utilities.iterables import multiset_permutations
%o def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
%o def A031443gen(): yield from (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1)))
%o def a(n):
%o if n > 1 and bin(n)[2:].strip("0") == "1": return -1
%o return next(k*n for k in A031443gen() if isbalanced(k*n))
%o print([a(n) for n in range(1, 47)]) # _Michael S. Branicky_, Dec 03 2022
%o (PARI) See Links section.
%Y Cf. A031443, A358857.
%K sign,base
%O 1,1
%A _Jeffrey Shallit_, Dec 03 2022