login
a(n) is the least number k > 0 such that the binary weight of k^n is n times the binary weight of k.
1

%I #30 Nov 08 2022 13:59:15

%S 1,21,5,21,17,17,9,113,17,49,665,37,149,17,275,163,33,41,97,67,141,67,

%T 135,197,49,267,81,81,69,779,1163,69,325,49,587,837,281,197,293,49,

%U 147,677,67,651,647,67,793,277,353,49,1233,1177,165,775,721,353,817,69,647,709,209,1233,69,67,263

%N a(n) is the least number k > 0 such that the binary weight of k^n is n times the binary weight of k.

%C a(n) is the least number k > 0 such that A000120(k^n) = n*A000120(k).

%C All terms are odd.

%C Conjecture: lim_{n -> infinity} a(n) = infinity.

%H Chai Wah Wu, <a href="/A358268/b358268.txt">Table of n, a(n) for n = 1..10000</a> (n = 1..1004 from Robert Israel)

%e a(3) = 5 because 5 = 101_2 and 5^3 = 1111101_2 so A000120(5) = 2, A000120(5^3) = 6 and 6 = 3*2.

%p f:= proc(n) local k;

%p for k from 1 by 2 do

%p if convert(convert(k^n,base,2),`+`) = n*convert(convert(k,base,2),`+`) then return k

%p fi

%p od

%p end proc:

%p map(f, [$1..50]);

%t a[n_] := Module[{k = 1}, While[Divide @@ DigitCount[k^{n, 1}, 2, 1] != n, k += 2]; k]; Array[a, 65] (* _Amiram Eldar_, Nov 07 2022 *)

%o (Python)

%o def a(n):

%o k = 1

%o while bin(k**n).count("1") != n*bin(k).count("1"): k += 2

%o return k

%o print([a(n) for n in range(1, 66)]) # _Michael S. Branicky_, Nov 06 2022

%o (Python 3.10+)

%o from itertools import count

%o def A358268(n): return next(filter(lambda k:k.bit_count()*n==(k**n).bit_count(),count(1,2))) # _Chai Wah Wu_, Nov 07 2022

%o (PARI) a(n) = my(k=1); while (hammingweight(k^n) != n*hammingweight(k), k++); k; \\ _Michel Marcus_, Nov 07 2022

%Y Cf. A000120, A083567, A212314.

%K nonn,base,look

%O 1,2

%A _Robert Israel_, Nov 06 2022