OFFSET
1,5
LINKS
Hugo Pfoertner, Table of n, a(n) for n = 1..10000
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