A361944 a(n) is the least k > 0 such that the binary expansion of k*n is an abelian square (A272653).
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, 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, 10, 3, 39, 1, 129, 2, 2, 3, 2, 9, 9, 8, 11, 3, 3, 2, 27, 2, 2, 3
Offset: 1
Examples
a(8) = A361943(8)/8 = 136/8 = 17.
Programs
-
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))) }
-
Python
from itertools import count 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) print([a(n) for n in range(1, 80)]) # Michael S. Branicky, Mar 31 2023 after Rémy Sigrist