login
Smallest odious number k (member of A000069) such that k*n is also odious.
1

%I #30 Feb 22 2022 12:21:01

%S 1,1,7,1,7,7,1,1,13,7,1,7,1,1,19,1,21,13,1,7,1,1,7,7,1,1,13,1,7,19,1,

%T 1,37,21,1,13,1,1,7,7,1,1,7,1,19,7,1,7,1,1,7,1,11,13,1,1,25,7,1,19,1,

%U 1,67,1,69,37,1,21,1,1,11,13,1,1,19,1,7,7,1,7

%N Smallest odious number k (member of A000069) such that k*n is also odious.

%C All terms are odd since if 2*j and 2*j*n are both odious, then so are j and j*n. - _Michael S. Branicky_, Feb 21 2022

%e For n = 5, we have 5*7 = 35, and both 7 and 35 are odious, and no smaller odious multiple of 5 works.

%t odiousQ[n_] := OddQ[DigitCount[n, 2, 1]]; a[n_] := Module[{k = 1}, While[!odiousQ[k] || !odiousQ[k*n], k++]; k]; Array[a, 100] (* _Amiram Eldar_, Feb 21 2022 *)

%o (Python)

%o def od(n): return bin(n).count("1")%2 == 1

%o def a(n):

%o k = 1

%o while not (od(k) and od(k*n)): k += 1

%o return k

%o print([a(n) for n in range(1, 81)]) # _Michael S. Branicky_, Feb 21 2022

%o (PARI) isodious(m) = hammingweight(m) % 2;

%o a(n) = my(k=1); while (!isodious(k) || !isodious(k*n), k++); k; \\ _Michel Marcus_, Feb 22 2022

%Y Cf. A000069, A351836 (analog for the evil numbers A001969).

%Y Cf. A178757 (where k is not necessarily odious).

%K nonn,base

%O 1,3

%A _Jeffrey Shallit_, Feb 21 2022