A317295 Numbers with a composite number of 1's in their binary expansion.
15, 23, 27, 29, 30, 39, 43, 45, 46, 51, 53, 54, 57, 58, 60, 63, 71, 75, 77, 78, 83, 85, 86, 89, 90, 92, 95, 99, 101, 102, 105, 106, 108, 111, 113, 114, 116, 119, 120, 123, 125, 126, 135, 139, 141, 142, 147, 149, 150, 153, 154, 156, 159, 163, 165, 166, 169, 170, 172, 175, 177, 178, 180, 183, 184, 187, 189, 190
Offset: 1
Examples
23 is in the sequence because the binary expansion of 23 is 10111 and 10111 has four 1's, and 4 is a composite number (A002808).
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
Mathematica
Select[Range[200], CompositeQ[DigitCount[#, 2, 1]] &] (* Amiram Eldar, Jul 23 2023 *)
-
PARI
isok(n) = my(w = hammingweight(n)); (w != 1) && !isprime(w); \\ Michel Marcus, Aug 15 2018
-
Python
from sympy import isprime; isok = lambda n: n & (n-1) and not isprime(bin(n).count('1')) # David Radcliffe, Aug 15 2018
Comments