login
A052294
Pernicious numbers: numbers with a prime number of 1's in their binary expansion.
22
3, 5, 6, 7, 9, 10, 11, 12, 13, 14, 17, 18, 19, 20, 21, 22, 24, 25, 26, 28, 31, 33, 34, 35, 36, 37, 38, 40, 41, 42, 44, 47, 48, 49, 50, 52, 55, 56, 59, 61, 62, 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,1
COMMENTS
No power of 2 is pernicious, but 2^n+1 always is.
If a prime p is of the form 2^k -1, then p is included in this sequence. - Leroy Quet, Sep 20 2008
There are A121497(n) n-bit members of this sequence. - Charles R Greathouse IV, Mar 22 2013
A list of programming codes for pernicious numbers can be found in the Rosetta Code link. - Martin Ettl, May 27 2014
The even perfect numbers (A000396) are terms, since A000120(2^(p-1)*(2^p-1)) = p is prime when p is prime. - Amiram Eldar, Feb 01 2026
REFERENCES
Tianxin Cai, Perfect Numbers And Fibonacci Sequences, World Scientific, 2022, p. 50.
Simon Colton, Automated Theory Formation in Pure Mathematics, Springer, 2002, p. 242.
Simon Colton, Computational Discovery in Pure Mathematics, in: S. Džeroski, P. Langley, and L. Todorovsk, Computational Discovery of Scientific Knowledge, Springer, 2007, pp. 175-201. See p. 193.
Elena Deza, Mersenne Numbers And Fermat Numbers, World Scientific, 2021, pp. 207 and 263.
Elena Deza, Perfect and Amicable Numbers, World Scientific, 2023, p. 140.
LINKS
Iain Fox, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe, terms 1001..4000 from Daniel Arribas)
Giovanni Resta, pernicious numbers, Numbersaplenty.
Rosetta Code, Pernicious numbers.
Wikipedia, Pernicious number.
EXAMPLE
26 is in the sequence because the binary expansion of 26 is 11010 and 11010 has three 1's and 3 is prime, so the number of 1's in the binary expansion of 26 is prime. - Omar E. Pol, Apr 04 2016
MAPLE
filter:= n -> isprime(convert(convert(n, base, 2), `+`)):
select(filter, [$1..1000]); # Robert Israel, Oct 19 2014
MATHEMATICA
Select[Range[6! ], PrimeQ[DigitCount[ #, 2][[1]]]&] (* Vladimir Joseph Stephan Orlovsky, Feb 16 2010 *)
PROG
(Haskell)
a052294 n = a052294_list !! (n-1)
a052294_list = filter ((== 1) . a010051 . a000120) [1..]
-- Reinhard Zumkeller, Nov 16 2012
(PARI) is(n)=isprime(hammingweight(n)) \\ Charles R Greathouse IV, Mar 22 2013
(Python)
from sympy import isprime
def ok(n): return isprime(bin(n).count("1"))
print([k for k in range(101) if ok(k)]) # Michael S. Branicky, Jun 16 2022
(Python)
from sympy import isprime
def ok(n): return isprime(n.bit_count())
print([k for k in range(101) if ok(k)]) # Michael S. Branicky, Dec 27 2023
CROSSREFS
Cf. A262481 (subsequence).
Sequence in context: A277727 A080943 A363690 * A336101 A267895 A216189
KEYWORD
easy,base,nice,nonn
AUTHOR
Jeremy Gow (jeremygo(AT)dai.ed.ac.uk), Feb 08 2000
STATUS
approved