How to resolve the algorithm Pernicious numbers step by step in the PARI/GP programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Pernicious numbers step by step in the PARI/GP programming language
Table of Contents
Problem Statement
A pernicious number is a positive integer whose population count is a prime. The population count is the number of ones in the binary representation of a non-negative integer.
22 (which is 10110 in binary) has a population count of 3, which is prime, and therefore
22 is a pernicious number.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Pernicious numbers step by step in the PARI/GP programming language
Source code in the pari/gp programming language
pern(n)=isprime(hammingweight(n))
select(pern, [1..36])
select(pern,[888888877..888888888])
You may also check:How to resolve the algorithm EKG sequence convergence step by step in the Java programming language
You may also check:How to resolve the algorithm Check output device is a terminal step by step in the Lua programming language
You may also check:How to resolve the algorithm Factors of an integer step by step in the Maple programming language
You may also check:How to resolve the algorithm Pythagorean quadruples step by step in the Modula-2 programming language
You may also check:How to resolve the algorithm Fixed length records step by step in the Free Pascal programming language