cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A351149 #11 Feb 07 2022 12:09:31
%S A351149 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,
%T A351149 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,
%U A351149 5,7,3,3,3,4,3,4,3,3,1,3,5,5,3,2,3,5,11
%N 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.
%H A351149 Hugo Pfoertner, <a href="/A351149/b351149.txt">Table of n, a(n) for n = 1..10000</a>
%t A351149 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 *)
%o A351149 (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)))
%o A351149 (Python)
%o A351149 def A351149(n):
%o A351149     k = 1
%o A351149     while bin(n**k)[2:].count("1") < bin(n**(k+1))[2:].count("1"): k += 1
%o A351149     return(k)
%o A351149 print([A351149(n) for n in range(1, 88)]) # _Karl-Heinz Hofmann_, Feb 07 2022
%Y A351149 Cf. A000120, A094694, A211201, A231897.
%K A351149 nonn
%O A351149 1,5
%A A351149 _Hugo Pfoertner_, Feb 07 2022