How to resolve the algorithm Pernicious numbers step by step in the Panda programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Pernicious numbers step by step in the Panda 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 Panda programming language

Source code in the panda programming language

fun prime(a) type integer->integer
  a where count{{a.factor}}==2
fun pernisc(a) type integer->integer
  a where sum{{a.radix:2 .char.integer}}.integer.prime

1..36.pernisc
888888877..888888888.pernisc

  

You may also check:How to resolve the algorithm Primality by trial division step by step in the C programming language
You may also check:How to resolve the algorithm RIPEMD-160 step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Break OO privacy step by step in the C# programming language
You may also check:How to resolve the algorithm Van der Corput sequence step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Angle difference between two bearings step by step in the BASIC256 programming language