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 A358858 #15 Dec 04 2022 13:05:29 %S A358858 2,-1,147,-1,10,12,3745,-1,34587,8990,539,2364,156,728,135,-1,153,180, %T A358858 38,180,42,44,805,216,50,52,3969,56,62089,62850,1022721,-1,8515815, %U A358858 2158830,134715,553212,35557,34428,8814,144120,2296,8442,2107,8668,2205,2254 %N A358858 Least multiple m of n such that both m and m/n belong to A031443, or -1 if there is no such m. %C A358858 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 A358858 Rémy Sigrist, <a href="/A358858/b358858.txt">Table of n, a(n) for n = 1..10000</a> %H A358858 Rémy Sigrist, <a href="/A358858/a358858.gp.txt">PARI program</a> %F A358858 a(n) = n*A358857(n) unless a(n) = -1. - _Pontus von Brömssen_, Dec 03 2022 %e A358858 For n = 3 both 147 and 147/3=49 are in A031443. %o A358858 (Python) %o A358858 from itertools import count %o A358858 from sympy.utilities.iterables import multiset_permutations %o A358858 def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1") %o A358858 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 A358858 def a(n): %o A358858 if n > 1 and bin(n)[2:].strip("0") == "1": return -1 %o A358858 return next(k*n for k in A031443gen() if isbalanced(k*n)) %o A358858 print([a(n) for n in range(1, 47)]) # _Michael S. Branicky_, Dec 03 2022 %o A358858 (PARI) See Links section. %Y A358858 Cf. A031443, A358857. %K A358858 sign,base %O A358858 1,1 %A A358858 _Jeffrey Shallit_, Dec 03 2022