OFFSET
1,1
LINKS
Amiram Eldar, Table of n, a(n) for n = 1..10000
EXAMPLE
2 is a term since its binary weight is 1 and 2/1 = 2, which is a prime number.
6 (110 in binary) has a binary weight of 2 and 6/2 = 3, which is prime, so 6 is also in the sequence. Likewise 10 (1010 in binary) also has a binary weight of 2, and 10/2 = 5, which is prime, so 10 is also in the sequence.
14 (1110 in binary) has binary weight of 3. But 14/3 is not prime, so 14 is not in the sequence.
MAPLE
q:= n-> (p-> is(p, integer) and isprime(p))(n/add(i, i=Bits[Split](n))):
select(q, [$1..1200])[]; # Alois P. Heinz, Apr 23 2020
MATHEMATICA
Select[Range[1000], PrimeQ[# / DigitCount[#, 2, 1]] &]
PROG
(Scala) def isPrime(num: Int): Boolean = Math.abs(num) match {
case 0 => false; case 1 => false; case n => (2 to Math.floor(Math.sqrt(n)).toInt) forall (p => n % p != 0)
}
(1 to 1000).filter{ n => val binWt = Integer.bitCount(n); (n % binWt) == 0 && isPrime(n / binWt) } // Alonso del Arte, Apr 23 2020
(PARI) isok(m) = iferr(isprime(m/hammingweight(m)), E, 0); \\ Michel Marcus, Apr 24 2020
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amiram Eldar, Apr 23 2020
STATUS
approved