A381754 Numbers k such that k and 3*k have the same number of zeros in their binary expansions.
0, 1, 2, 4, 8, 16, 19, 32, 35, 38, 39, 53, 64, 67, 70, 71, 76, 78, 79, 101, 105, 106, 117, 128, 131, 134, 135, 140, 142, 143, 152, 156, 158, 159, 197, 201, 202, 209, 210, 212, 229, 233, 234, 245, 256, 259, 262, 263, 268, 270, 271, 280, 284, 286, 287, 301, 304
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
filter:= proc(n) numboccur(0,convert(n,base,2)) = numboccur(0,convert(3*n,base,2)) end proc: select(filter, [$0..400]); # Robert Israel, Apr 07 2025
-
Mathematica
Select[Range[0, 320], Equal @@ DigitCount[{#, 3*#}, 2, 0] &] (* Amiram Eldar, Mar 06 2025 *)
-
PARI
nz(n) = if(n == 0, 1, 1+logint(n, 2) - hammingweight(n)) is(n)=nz(n)==nz(3*n) \\ Charles R Greathouse IV, Mar 06 2025
-
Python
def ok(n): return bin(n).count('0') == bin(n * 3).count('0')
Comments