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
Robert Israel, Table of n, a(n) for n = 1..10000
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
KEYWORD
nonn,base,easy
AUTHOR
Omar E. Pol, Aug 10 2018
STATUS
approved