A334344 Binary Moran numbers: numbers k such that k divided by its binary weight (A000120) is a prime number.
2, 6, 10, 21, 34, 55, 69, 92, 115, 116, 155, 172, 185, 205, 212, 222, 246, 284, 295, 318, 321, 332, 355, 356, 366, 395, 404, 438, 452, 474, 498, 514, 535, 556, 565, 596, 606, 623, 652, 749, 788, 822, 835, 865, 889, 905, 973, 978, 1041, 1052, 1076, 1086, 1108, 1124
Offset: 1
Examples
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.
Links
- Amiram Eldar, Table of n, a(n) for n = 1..10000
Programs
-
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]] &]
-
PARI
isok(m) = iferr(isprime(m/hammingweight(m)), E, 0); \\ Michel Marcus, Apr 24 2020
-
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