A317294 Numbers with a noncomposite number of 1's in their binary expansion.
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
Examples
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.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
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 *)
-
PARI
is(n) = my(h=hammingweight(n)); ispseudoprime(h) || h==1 \\ Felix Fröhlich, Aug 10 2018
Comments