login
A351149
a(n) is the least exponent k such that the Hamming weight of n^(k+1) is not greater than the Hamming weight of n^k.
2
1, 1, 1, 1, 3, 1, 1, 1, 3, 3, 5, 1, 7, 1, 1, 1, 3, 3, 4, 3, 2, 5, 1, 1, 4, 7, 5, 1, 5, 1, 1, 1, 3, 3, 7, 3, 4, 4, 3, 3, 5, 2, 5, 5, 3, 1, 1, 1, 5, 4, 7, 7, 2, 5, 3, 1, 3, 5, 2, 1, 3, 1, 1, 1, 3, 3, 4, 3, 5, 7, 3, 3, 3, 4, 3, 4, 3, 3, 1, 3, 5, 5, 3, 2, 3, 5, 11
OFFSET
1,5
LINKS
MATHEMATICA
a[n_] := Module[{k = 1}, While[DigitCount[n^k, 2, 1] < DigitCount[n^(k + 1), 2, 1], k++]; k]; Array[a, 100] (* Amiram Eldar, Feb 07 2022 *)
PROG
(PARI) for(n=1, 87, for(k=1, oo, my(hw1=hammingweight(n^k), hw2=hammingweight(n^(k+1))); if(hw2<=hw1, print1(k, ", "); break)))
(Python)
def A351149(n):
k = 1
while bin(n**k)[2:].count("1") < bin(n**(k+1))[2:].count("1"): k += 1
return(k)
print([A351149(n) for n in range(1, 88)]) # Karl-Heinz Hofmann, Feb 07 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Hugo Pfoertner, Feb 07 2022
STATUS
approved