%I #6 Apr 01 2023 08:54:33
%S 3,5,1,9,2,6,9,17,1,1,3,3,10,11,1,33,2,2,10,26,3,6,2,22,6,5,2,21,25,5,
%T 33,65,1,1,18,1,6,5,4,13,15,14,1,3,1,1,5,11,3,3,1,3,1,1,3,41,9,37,11,
%U 10,3,39,1,129,2,2,3,2,9,9,8,11,3,3,2,27,2,2,3
%N a(n) is the least k > 0 such that the binary expansion of k*n is an abelian square (A272653).
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = A361943(n) / n.
%F a(n) = 1 iff n belongs to A272653.
%e a(8) = A361943(8)/8 = 136/8 = 17.
%o (PARI) a(n) = { forstep (m = n, oo, n, my (w = #binary(m)); if (w%2==0 && hammingweight(m)==2*hammingweight(m % (2^(w/2))), return (m/n))) }
%o (Python)
%o from itertools import count
%o def a(n): return next(m//n for m in count(n, n) if not (w:= m.bit_length())&1 and m.bit_count() == ((m>>(w>>1)).bit_count())<<1)
%o print([a(n) for n in range(1, 80)]) # _Michael S. Branicky_, Mar 31 2023 after _Rémy Sigrist_
%Y Cf. A272653, A361943.
%K nonn,base
%O 1,1
%A _Rémy Sigrist_, Mar 31 2023
|