cp's OEIS Frontend

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.

Showing 1-1 of 1 results.

A358858 Least multiple m of n such that both m and m/n belong to A031443, or -1 if there is no such m.

Original entry on oeis.org

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

Views

Author

Jeffrey Shallit, Dec 03 2022

Keywords

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.

Examples

			For n = 3 both 147 and 147/3=49 are in A031443.
		

Crossrefs

Programs

  • PARI
    See Links section.
  • 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
    

Formula

a(n) = n*A358857(n) unless a(n) = -1. - Pontus von Brömssen, Dec 03 2022
Showing 1-1 of 1 results.