Perl Weekly Challenge 156: Pernicious and Weird Numbers
These are some answers to the Week 156 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler Alert: This weekly challenge deadline is due in a few days from now (on March 20, 2022 at 24:00). This blog post offers some solutions to this challenge, please don’t read on if you intend to complete the challenge on your own.
Task 1: Pernicious Numbers
Write a script to permute first 10 Pernicious Numbers.
A pernicious number is a positive integer which has prime number of ones in its binary representation.
The first pernicious number is 3 since binary representation of 3 = (11) and 1 + 1 = 2, which is a prime.
Expected Output:
3, 5, 6, 7, 9, 10, 11, 12, 13, 14
I’m not sure why the task description speaks about permuting the first 10 pernicious numbers. It seems we’re simply requested to display them.
