A351599 a(n) is the smallest integer m > 0 such that m*n is a digitally balanced number (A031443).
2, 1, 3, 3, 2, 2, 5, 7, 1, 1, 4, 1, 4, 3, 9, 15, 9, 10, 2, 9, 2, 2, 8, 9, 2, 2, 5, 2, 8, 5, 17, 31, 5, 5, 1, 5, 1, 1, 4, 6, 1, 1, 4, 1, 3, 4, 3, 5, 1, 1, 3, 1, 4, 4, 3, 1, 4, 4, 3, 3, 13, 9, 33, 63, 3, 3, 3, 3, 10, 3, 2, 3, 11, 9, 2, 3, 2, 2, 8, 3, 10, 9, 2
Offset: 1
Programs
-
Mathematica
balQ[n_] := Module[{d = IntegerDigits[n, 2], m}, EvenQ@(m = Length@d) && Count[d, 1] == m/2]; a[n_] := Module[{k = 1}, While[!balQ[k*n], k++]; k]; Array[a, 100] (* Amiram Eldar, May 02 2022 *)
-
PARI
is(n) = hammingweight(n)==hammingweight(bitneg(n, #binary(n))); \\ A031443 a(n) = my(m=1); while (!is(m*n), m++); m; \\ Michel Marcus, May 02 2022
Formula
a(n) = A143146(n) / n. - Rémy Sigrist, Jul 11 2022