login
A317294
Numbers with a noncomposite number of 1's in their binary expansion.
2
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 47, 48, 49, 50, 52, 55, 56, 59, 61, 62, 64, 65, 66, 67, 68, 69, 70, 72, 73, 74, 76, 79, 80, 81, 82, 84, 87, 88, 91, 93, 94, 96, 97, 98, 100
OFFSET
1,2
COMMENTS
Union of powers of 2 and pernicious numbers.
All powers of 2 are in the sequence because the binary expansion of a power of 2 contains only one digit "1" and 1 is a noncomposite number (A008578).
If k is in the sequence then so is 2*k. - David A. Corneth, Aug 10 2018
LINKS
EXAMPLE
8 is in the sequence because the binary expansion of 8 is 1000 and 1000 has one 1, and 1 is a noncomposite number (A008578).
26 is in the sequence because the binary expansion of 26 is 11010 and 11010 has three 1's, and 3 is a noncomposite number.
MAPLE
filter:= proc(n) local w;
w:= convert(convert(n, base, 2), `+`);
w=1 or isprime(w)
end proc:
select(filter, [$1..1000]); # Robert Israel, Aug 15 2018
MATHEMATICA
Select[Range[100], !CompositeQ[DigitCount[#, 2, 1]] &] (* Amiram Eldar, Jul 23 2023 *)
PROG
(PARI) is(n) = my(h=hammingweight(n)); ispseudoprime(h) || h==1 \\ Felix Fröhlich, Aug 10 2018
CROSSREFS
Union of A000079 and A052294.
The complement is A317295.
All terms of A000051 are in this sequence.
Sequence in context: A023756 A080944 A321291 * A095736 A004829 A075592
KEYWORD
nonn,base,easy
AUTHOR
Omar E. Pol, Aug 10 2018
STATUS
approved