cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-1 of 1 results.

A317294 Numbers with a noncomposite number of 1's in their binary expansion.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Aug 10 2018

Keywords

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

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.
		

Crossrefs

Union of A000079 and A052294.
The complement is A317295.
All terms of A000051 are in this sequence.

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
Showing 1-1 of 1 results.