WeixiangYan/CodeTransOcean huggingface dataset:
Task: Pernicious numbers





Java: public class Pernicious{
    
    public static boolean isPrime(int x){
        if(x < 2) return false;
        for(int i = 2; i < x; i++){
            if(x % i == 0) return false;
        }
        return true;
    }

    public static int popCount(long x){
        return Long.bitCount(x);
    }

    public static void main(String[] args){
        for(long i = 1, n = 0; n < 25; i++){
            if(isPrime(popCount(i))){
                System.out.print(i + " ");
                n++;
            }
        }
        
        System.out.println();
        
        for(long i = 888888877; i <= 888888888; i++){
            if(isPrime(popCount(i))) System.out.print(i + " ");
        }
    }
}







Ada: with Ada.Text_IO, Population_Count; use Population_Count;

procedure Pernicious is
   
   Prime: array(0 .. 64) of Boolean; 
     
   X: Num; use type Num;
   Cnt: Positive;
begin
   
   Prime := (0 => False, 1 => False, others => True);
   for I in 2 .. 8 loop
      if Prime(I) then
	 Cnt := I + I;
	 while Cnt <= 64 loop
	    Prime(Cnt) := False;
	    Cnt := Cnt + I;
	 end loop;
      end if;
   end loop;
   
   
   X := 1;
   for I in 1 .. 25 loop
      while not Prime(Pop_Count(X)) loop 
	 X := X + 1;
      end loop;
      Ada.Text_IO.Put(Num'Image(X));
      X := X + 1;
   end loop;
   Ada.Text_IO.New_Line;
   
   
   for Y in Num(888_888_877) .. 888_888_888 loop
      if Prime(Pop_Count(Y)) then
	 Ada.Text_IO.Put(Num'Image(Y));
      end if;
   end loop;
   Ada.Text_IO.New_Line;   
end;
Task: Pernicious numbers







Python: >>> def popcount(n): return bin(n).count("1")

>>> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61}
>>> p, i = [], 0
>>> while len(p) < 25:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[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]
>>> p, i = [], 888888877
>>> while i <= 888888888:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[888888877, 888888878, 888888880, 888888883, 888888885, 888888886]
>>>





Ada: with Ada.Text_IO, Population_Count; use Population_Count;

procedure Pernicious is
   
   Prime: array(0 .. 64) of Boolean; 
     
   X: Num; use type Num;
   Cnt: Positive;
begin
   
   Prime := (0 => False, 1 => False, others => True);
   for I in 2 .. 8 loop
      if Prime(I) then
	 Cnt := I + I;
	 while Cnt <= 64 loop
	    Prime(Cnt) := False;
	    Cnt := Cnt + I;
	 end loop;
      end if;
   end loop;
   
   
   X := 1;
   for I in 1 .. 25 loop
      while not Prime(Pop_Count(X)) loop 
	 X := X + 1;
      end loop;
      Ada.Text_IO.Put(Num'Image(X));
      X := X + 1;
   end loop;
   Ada.Text_IO.New_Line;
   
   
   for Y in Num(888_888_877) .. 888_888_888 loop
      if Prime(Pop_Count(Y)) then
	 Ada.Text_IO.Put(Num'Image(Y));
      end if;
   end loop;
   Ada.Text_IO.New_Line;   
end;
Task: Pernicious numbers








VB: Private Function population_count(ByVal number As Long) As Integer
    Dim result As Integer
    Dim digit As Integer
    Do While number > 0
        If number Mod 2 = 1 Then
            result = result + 1
        End If
        number = number \ 2
    Loop
    population_count = result
End Function

Function is_prime(n As Integer) As Boolean
    If n < 2 Then
        is_prime = False
        Exit Function
    End If
    For i = 2 To Sqr(n)
        If n Mod i = 0 Then
            is_prime = False
            Exit Function
        End If
    Next i
    is_prime = True
End Function
 
Function pernicious(n As Long)
    Dim tmp As Integer
    tmp = population_count(n)
    pernicious = is_prime(tmp)
End Function
 
Public Sub main()
    Dim count As Integer
    Dim n As Long: n = 1
    Do While count < 25
        If pernicious(n) Then
            Debug.Print n;
            count = count + 1
        End If
        n = n + 1
    Loop
    Debug.Print
    For n = 888888877 To 888888888
        If pernicious(n) Then
            Debug.Print n;
        End If
    Next n
End Sub




Ada: with Ada.Text_IO, Population_Count; use Population_Count;

procedure Pernicious is
   
   Prime: array(0 .. 64) of Boolean; 
     
   X: Num; use type Num;
   Cnt: Positive;
begin
   
   Prime := (0 => False, 1 => False, others => True);
   for I in 2 .. 8 loop
      if Prime(I) then
	 Cnt := I + I;
	 while Cnt <= 64 loop
	    Prime(Cnt) := False;
	    Cnt := Cnt + I;
	 end loop;
      end if;
   end loop;
   
   
   X := 1;
   for I in 1 .. 25 loop
      while not Prime(Pop_Count(X)) loop 
	 X := X + 1;
      end loop;
      Ada.Text_IO.Put(Num'Image(X));
      X := X + 1;
   end loop;
   Ada.Text_IO.New_Line;
   
   
   for Y in Num(888_888_877) .. 888_888_888 loop
      if Prime(Pop_Count(Y)) then
	 Ada.Text_IO.Put(Num'Image(Y));
      end if;
   end loop;
   Ada.Text_IO.New_Line;   
end;
Task: Pernicious numbers

C: #include <stdio.h>
 
typedef unsigned uint;
uint is_pern(uint n)
{
        uint c = 2693408940u; 
        while (n) c >>= 1, n &= (n - 1); 
        return c & 1;
}
 
int main(void)
{
        uint i, c;
        for (i = c = 0; c < 25; i++)
                if (is_pern(i))
                        printf("%u ", i), ++c;
        putchar('\n');
 
        for (i = 888888877u; i <= 888888888u; i++)
                if (is_pern(i))
                        printf("%u ", i);
        putchar('\n');
 
        return 0;
}
Task: Pernicious numbers



C#: using System;
using System.Linq;

namespace PerniciousNumbers
{
    class Program
    {
        public static int PopulationCount(long n)
        {
            int cnt = 0;
            do
            {
                if ((n & 1) != 0) 
                {
                    cnt++;
                }
            } while ((n >>= 1) > 0);

            return cnt;
        }

         public static bool isPrime(int x)
        {
            if (x <= 2 || (x & 1) == 0)
            {
                return x == 2;
            }

            var limit = Math.Sqrt(x);
            for (int i = 3; i <= limit; i += 2)
            {
                if (x % i == 0)
                {
                    return false;
                }
            }

            return true;
        }

        private static IEnumerable<int> Pernicious(int start, int count, int take)
        {
            return Enumerable.Range(start, count).Where(n => isPrime(PopulationCount(n))).Take(take);
        }

        static void Main(string[] args)
        {
            foreach (var n in Pernicious(0, int.MaxValue, 25))
            {
                Console.Write("{0} ", n);
            }

            Console.WriteLine();

            foreach (var n in Pernicious(888888877, 11, 11))
            {
                Console.Write("{0} ", n);
            }

            Console.ReadKey();
        }
    }
}
Task: Pernicious numbers


C++: #include <iostream>
using namespace std;

int main() {
    int cnt = 0, cnt2, cnt3, tmp, binary[8];
    for (int i = 3; cnt < 25; i++) {
        tmp = i;
        cnt2 = 0;
        cnt3 = 0;
        for (int j = 7; j > 0; j--) {
            binary[j] = tmp % 2;
            tmp /= 2;
        }
        binary[0] = tmp;
        for (int j = 0; j < 8; j++) {
            if (binary[j] == 1) {
                cnt2++;
            }
        }
        for (int j = 2; j <= (cnt2 / 2); j++) {
            if (cnt2 % j == 0) {
                cnt3++;
                break;
            }
        }
        if (cnt3 == 0 && cnt2 != 1) {
            cout << i << endl;
            cnt++;
        }
    }

    cout << endl;
    int binary2[31];

    for (int i = 888888877; i <= 888888888; i++) {
        tmp = i;
        cnt2 = 0;
        cnt3 = 0;
        for (int j = 30; j > 0; j--) {
            binary2[j] = tmp % 2;
            tmp /= 2;
        }
        binary2[0] = tmp;
        for (int j = 0; j < 31; j++) {
            if (binary2[j] == 1) {
                cnt2++;
            }
        }
        for (int j = 2; j <= (cnt2 / 2); j++) {
            if (cnt2 % j == 0) {
                cnt3++;
                break;
            }
        }
        if (cnt3 == 0 && cnt2 != 1) {
            cout << i << endl;
        }
    }
}
Task: Pernicious numbers





Java: public class Pernicious{
    
    public static boolean isPrime(int x){
        if(x < 2) return false;
        for(int i = 2; i < x; i++){
            if(x % i == 0) return false;
        }
        return true;
    }

    public static int popCount(long x){
        return Long.bitCount(x);
    }

    public static void main(String[] args){
        for(long i = 1, n = 0; n < 25; i++){
            if(isPrime(popCount(i))){
                System.out.print(i + " ");
                n++;
            }
        }
        
        System.out.println();
        
        for(long i = 888888877; i <= 888888888; i++){
            if(isPrime(popCount(i))) System.out.print(i + " ");
        }
    }
}
Task: Pernicious numbers







Python: >>> def popcount(n): return bin(n).count("1")

>>> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61}
>>> p, i = [], 0
>>> while len(p) < 25:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[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]
>>> p, i = [], 888888877
>>> while i <= 888888888:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[888888877, 888888878, 888888880, 888888883, 888888885, 888888886]
>>>
Task: Pernicious numbers








VB: Public Sub Main()  
  
  Dim n As Integer = 1, count As Integer = 0 

  Print "The following are the first 25 pernicious numbers:\n" 
  
  Do 
    If isPernicious(n) Then 
      Print Format$(n, "###"); 
      count += 1 
    End If 
    n += 1 
  Loop Until count = 25 
  
  Print "\n\nThe pernicious numbers between 888,888,877 and 888,888,888 inclusive are:\n" 
  For n = 888888877 To 888888888 
    If isPernicious(n) Then Print Format$(n, "##########"); 
  Next
  Print

End

Public Sub isPrime(ValorEval As Long) As Boolean  
  
  If ValorEval < 2 Then Return False  
  If ValorEval Mod 2 = 0 Then Return ValorEval = 2  
  If ValorEval Mod 3 = 0 Then Return ValorEval = 3  
  Dim d As Long = 5  
  While d * d <= ValorEval  
    If ValorEval Mod d = 0 Then Return False Else d += 2  
  Wend   
  Return True  
  
End Function 

Public Function SumBinaryDigits(number As Integer) As Integer 
  
  If number < 0 Then number = -number 
  Dim sum As Integer = 0 
  While number > 0 
    sum += number Mod 2 
    number \= 2 
  Wend 
  Return sum 
  
End Function

Public Function isPernicious(number As Integer) As Boolean 
  
  Dim popCount As Integer = SumBinaryDigits(number) 

  Return isPrime(popCount) 
  
End Function
Task: Pernicious numbers




Go: package main

import "fmt"

func pernicious(w uint32) bool {
    const (
        ff    = 1<<32 - 1
        mask1 = ff / 3
        mask3 = ff / 5
        maskf = ff / 17
        maskp = ff / 255
    )
    w -= w >> 1 & mask1
    w = w&mask3 + w>>2&mask3
    w = (w + w>>4) & maskf
    return 0xa08a28ac>>(w*maskp>>24)&1 != 0
}

func main() {
    for i, n := 0, uint32(1); i < 25; n++ {
        if pernicious(n) {
            fmt.Printf("%d ", n)
            i++
        }
    }
    fmt.Println()
    for n := uint32(888888877); n <= 888888888; n++ {
        if pernicious(n) {
            fmt.Printf("%d ", n)
        }
    }
    fmt.Println()
}
Task: Pernicious numbers



C#: using System;
using System.Linq;

namespace PerniciousNumbers
{
    class Program
    {
        public static int PopulationCount(long n)
        {
            int cnt = 0;
            do
            {
                if ((n & 1) != 0) 
                {
                    cnt++;
                }
            } while ((n >>= 1) > 0);

            return cnt;
        }

         public static bool isPrime(int x)
        {
            if (x <= 2 || (x & 1) == 0)
            {
                return x == 2;
            }

            var limit = Math.Sqrt(x);
            for (int i = 3; i <= limit; i += 2)
            {
                if (x % i == 0)
                {
                    return false;
                }
            }

            return true;
        }

        private static IEnumerable<int> Pernicious(int start, int count, int take)
        {
            return Enumerable.Range(start, count).Where(n => isPrime(PopulationCount(n))).Take(take);
        }

        static void Main(string[] args)
        {
            foreach (var n in Pernicious(0, int.MaxValue, 25))
            {
                Console.Write("{0} ", n);
            }

            Console.WriteLine();

            foreach (var n in Pernicious(888888877, 11, 11))
            {
                Console.Write("{0} ", n);
            }

            Console.ReadKey();
        }
    }
}








Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers


C++: #include <iostream>
using namespace std;

int main() {
    int cnt = 0, cnt2, cnt3, tmp, binary[8];
    for (int i = 3; cnt < 25; i++) {
        tmp = i;
        cnt2 = 0;
        cnt3 = 0;
        for (int j = 7; j > 0; j--) {
            binary[j] = tmp % 2;
            tmp /= 2;
        }
        binary[0] = tmp;
        for (int j = 0; j < 8; j++) {
            if (binary[j] == 1) {
                cnt2++;
            }
        }
        for (int j = 2; j <= (cnt2 / 2); j++) {
            if (cnt2 % j == 0) {
                cnt3++;
                break;
            }
        }
        if (cnt3 == 0 && cnt2 != 1) {
            cout << i << endl;
            cnt++;
        }
    }

    cout << endl;
    int binary2[31];

    for (int i = 888888877; i <= 888888888; i++) {
        tmp = i;
        cnt2 = 0;
        cnt3 = 0;
        for (int j = 30; j > 0; j--) {
            binary2[j] = tmp % 2;
            tmp /= 2;
        }
        binary2[0] = tmp;
        for (int j = 0; j < 31; j++) {
            if (binary2[j] == 1) {
                cnt2++;
            }
        }
        for (int j = 2; j <= (cnt2 / 2); j++) {
            if (cnt2 % j == 0) {
                cnt3++;
                break;
            }
        }
        if (cnt3 == 0 && cnt2 != 1) {
            cout << i << endl;
        }
    }
}









Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers

C: #include <stdio.h>
 
typedef unsigned uint;
uint is_pern(uint n)
{
        uint c = 2693408940u; 
        while (n) c >>= 1, n &= (n - 1); 
        return c & 1;
}
 
int main(void)
{
        uint i, c;
        for (i = c = 0; c < 25; i++)
                if (is_pern(i))
                        printf("%u ", i), ++c;
        putchar('\n');
 
        for (i = 888888877u; i <= 888888888u; i++)
                if (is_pern(i))
                        printf("%u ", i);
        putchar('\n');
 
        return 0;
}










Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers




Go: package main

import "fmt"

func pernicious(w uint32) bool {
    const (
        ff    = 1<<32 - 1
        mask1 = ff / 3
        mask3 = ff / 5
        maskf = ff / 17
        maskp = ff / 255
    )
    w -= w >> 1 & mask1
    w = w&mask3 + w>>2&mask3
    w = (w + w>>4) & maskf
    return 0xa08a28ac>>(w*maskp>>24)&1 != 0
}

func main() {
    for i, n := 0, uint32(1); i < 25; n++ {
        if pernicious(n) {
            fmt.Printf("%d ", n)
            i++
        }
    }
    fmt.Println()
    for n := uint32(888888877); n <= 888888888; n++ {
        if pernicious(n) {
            fmt.Printf("%d ", n)
        }
    }
    fmt.Println()
}







Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers





Java: public class Pernicious{
    
    public static boolean isPrime(int x){
        if(x < 2) return false;
        for(int i = 2; i < x; i++){
            if(x % i == 0) return false;
        }
        return true;
    }

    public static int popCount(long x){
        return Long.bitCount(x);
    }

    public static void main(String[] args){
        for(long i = 1, n = 0; n < 25; i++){
            if(isPrime(popCount(i))){
                System.out.print(i + " ");
                n++;
            }
        }
        
        System.out.println();
        
        for(long i = 888888877; i <= 888888888; i++){
            if(isPrime(popCount(i))) System.out.print(i + " ");
        }
    }
}






Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers







Python: >>> def popcount(n): return bin(n).count("1")

>>> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61}
>>> p, i = [], 0
>>> while len(p) < 25:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[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]
>>> p, i = [], 888888877
>>> while i <= 888888888:
        if popcount(i) in primes: p.append(i)
        i += 1

        
>>> p
[888888877, 888888878, 888888880, 888888883, 888888885, 888888886]
>>>




Fortran: program pernicious
  implicit none

  integer :: i, n

  i = 1
  n = 0
  do
    if(isprime(popcnt(i))) then
      write(*, "(i0, 1x)", advance = "no") i
      n = n + 1
      if(n == 25) exit
    end if
    i = i + 1
  end do
  
  write(*,*)
  do i = 888888877, 888888888
    if(isprime(popcnt(i))) write(*, "(i0, 1x)", advance = "no") i
  end do 

contains

function popcnt(x)
  integer :: popcnt
  integer, intent(in) :: x
  integer :: i
 
  popcnt = 0
  do i = 0, 31
    if(btest(x, i)) popcnt = popcnt + 1
  end do
 
end function

function isprime(number)
  logical :: isprime
  integer, intent(in) :: number
  integer :: i
 
  if(number == 2) then
    isprime = .true.
  else if(number < 2 .or. mod(number,2) == 0) then
    isprime = .false.
  else
    isprime = .true.
    do i = 3, int(sqrt(real(number))), 2
      if(mod(number,i) == 0) then
        isprime = .false.
        exit
      end if
    end do
  end if
end function
end program
Task: Pernicious numbers








VB: Private Function population_count(ByVal number As Long) As Integer
    Dim result As Integer
    Dim digit As Integer
    Do While number > 0
        If number Mod 2 = 1 Then
            result = result + 1
        End If
        number = number \ 2
    Loop
    population_count = result
End Function

Function is_prime(n As Integer) As Boolean
    If n < 2 Then
        is_prime = False
        Exit Function
    End If
    For i = 2 To Sqr(n)
        If n Mod i = 0 Then
            is_prime = False
            Exit Function
        End If
    Next i
    is_prime = True
End Function
 
Function pernicious(n As Long)
    Dim tmp As Integer
    tmp = population_count(n)
    pernicious = is_prime(tmp)
End Function
 
Public Sub main()
    Dim count As Integer
    Dim n As Long: n = 1
    Do While count < 25
        If pernicious(n) Then
            Debug.Print n;
            count = count + 1
        End If
        n = n + 1
    Loop
    Debug.Print
    For n = 888888877 To 888888888
        If pernicious(n) Then
            Debug.Print n;
        End If
    Next n
End Sub