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!)
A358857 Least integer k in A031443 such that k*n is also in A031443, or -1 if there is no such k. 2
2, -1, 49, -1, 2, 2, 535, -1, 3843, 899, 49, 197, 12, 52, 9, -1, 9, 10, 2, 9, 2, 2, 35, 9, 2, 2, 147, 2, 2141, 2095, 32991, -1, 258055, 63495, 3849, 15367, 961, 906, 226, 3603, 56, 201, 49, 197, 49, 49, 50, 789, 56, 56, 42, 209, 50, 42, 44, 41, 10, 12, 10, 41 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
COMMENTS
It's clear that a(2^i)=-1 if i>0, because 2^i*n always has more 0's than n does. I do not know if every number other than a power
of 2 has such a k. Local maxima seem to be near odd powers of 2. It is not hard to show that a(2^n +- 1)!=-1 for n>=1.
LINKS
Rémy Sigrist, PARI program
FORMULA
a(n) = A358858(n)/n unless a(n) = -1. - Pontus von Brömssen, Dec 03 2022
EXAMPLE
For n = 3 both 49 = [110001] and 49*3 = [10010011] have the same number of 0's as 1's, and this is the least such.
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 for k in A031443gen() if isbalanced(k*n))
print([a(n) for n in range(1, 61)]) # Michael S. Branicky, Dec 03 2022
(PARI) See Links section.
CROSSREFS
Sequence in context: A100018 A255856 A037056 * A109347 A054210 A225778
KEYWORD
sign,base
AUTHOR
Jeffrey Shallit, Dec 03 2022
STATUS
approved

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 August 24 20:58 EDT 2024. Contains 375417 sequences. (Running on oeis4.)