login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A358858
Least multiple m of n such that both m and m/n belong to A031443, or -1 if there is no such m.
2
2, -1, 147, -1, 10, 12, 3745, -1, 34587, 8990, 539, 2364, 156, 728, 135, -1, 153, 180, 38, 180, 42, 44, 805, 216, 50, 52, 3969, 56, 62089, 62850, 1022721, -1, 8515815, 2158830, 134715, 553212, 35557, 34428, 8814, 144120, 2296, 8442, 2107, 8668, 2205, 2254
OFFSET
1,1
COMMENTS
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.
LINKS
Rémy Sigrist, PARI program
FORMULA
a(n) = n*A358857(n) unless a(n) = -1. - Pontus von Brömssen, Dec 03 2022
EXAMPLE
For n = 3 both 147 and 147/3=49 are in A031443.
PROG
(Python)
from itertools import count
from sympy.utilities.iterables import multiset_permutations
def isbalanced(n): b = bin(n)[2:]; return b.count("0") == b.count("1")
def A031443gen(): yield from (int("1"+"".join(p), 2) for n in count(1) for p in multiset_permutations("0"*n+"1"*(n-1)))
def a(n):
if n > 1 and bin(n)[2:].strip("0") == "1": return -1
return next(k*n for k in A031443gen() if isbalanced(k*n))
print([a(n) for n in range(1, 47)]) # Michael S. Branicky, Dec 03 2022
(PARI) See Links section.
CROSSREFS
Sequence in context: A335600 A039923 A081708 * A012004 A101923 A010788
KEYWORD
sign,base
AUTHOR
Jeffrey Shallit, Dec 03 2022
STATUS
approved