WeixiangYan/CodeTransOcean huggingface dataset:
Task: 100 doors

C: #include <stdio.h>

int main()
{
  char is_open[100] = { 0 };
  int pass, door;

  
  for (pass = 0; pass < 100; ++pass)
    for (door = pass; door < 100; door += pass+1)
      is_open[door] = !is_open[door];

  
  for (door = 0; door < 100; ++door)
    printf("door #%d is %s.\n", door+1, (is_open[door]? "open" : "closed"));

  return 0;
}









COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors



C#: namespace ConsoleApplication1
{
    using System;
    class Program
    {
        static void Main(string[] args)
        {
            bool[] doors = new bool[100];

            
            for (int d = 0; d < 100; d++) doors[d] = false;

            
            for (int p = 0; p < 100; p++)
            {
                
                for (int d = 0; d < 100; d++)
                {
                    if ((d + 1) % (p + 1) == 0)
                    {
                        doors[d] = !doors[d];
                    }
                }
            }

            
            Console.WriteLine("Passes Completed!!!  Here are the results: \r\n");
            for (int d = 0; d < 100; d++)
            {
                if (doors[d])
                {
                    Console.WriteLine(String.Format("Door #{0}: Open", d + 1));
                }
                else
                {
                    Console.WriteLine(String.Format("Door #{0}: Closed", d + 1));
                }
            }
            Console.ReadKey(true);
        }
    }
}







COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors


C++: #include <iostream>

int main()
{
  bool is_open[100] = { false };

  
  for (int pass = 0; pass < 100; ++pass)
    for (int door = pass; door < 100; door += pass+1)
      is_open[door] = !is_open[door];

  
  for (int door = 0; door < 100; ++door)
    std::cout << "door #" << door+1 << (is_open[door]? " is open." : " is closed.") << std::endl;
  return 0;
}








COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors





Java: module OneHundredDoors
    {
    @Inject Console console;

    void run()
        {
        Boolean[] doors = new Boolean[100];
        for (Int pass : 0 ..< 100)
            {
            for (Int door = pass; door < 100; door += 1+pass)
                {
                doors[door] = !doors[door];
                }
            }

        console.print($"open doors: {doors.mapIndexed((d, i) -> d ? i+1 : 0).filter(i -> i > 0)}");
        }
    }





COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors







Python: var doors = falses(100)

for a in 1..100: for b in a..a..100:
    doors[b] = not doors[b]

for a in 1..100:
    print "Door $a is ${(doors[a]) ? 'open.': 'closed.'}"



COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors








VB: dim x as integer, y as integer
dim door(1 to 100) as byte


for x = 1 to 100 : door(x) = 0 : next


for y = 1 to 100
    for x = y to 100 step y
        door(x) = not door(x)
    next x
next y


for x = 1 to 100
    if door(x) then print "Door " + str$(x) + " = open"
next 

while inkey$="":wend
end


COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors




Go: package main

import "fmt"

func main() {
    doors := [100]bool{}

    
    for pass := 1; pass <= 100; pass++ {
        for door := pass-1; door < 100; door += pass {
            doors[door] = !doors[door]
        }
    }

    
    for i, v := range doors {
        if v {
            fmt.Print("1")
        } else {
            fmt.Print("0")
        }

        if i%10 == 9 {
            fmt.Print("\n")
        } else {
            fmt.Print(" ")
        }

    }
}






COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: 100 doors






PHP: <?php
for ($i = 1; $i <= 100; $i++) {
	$root = sqrt($i);
	$state = ($root == ceil($root)) ? 'open' : 'closed';
	echo "Door {$i}: {$state}\n";
}
?>
Task: 100 doors






PHP: <?php
for ($i = 1; $i <= 100; $i++) {
	$root = sqrt($i);
	$state = ($root == ceil($root)) ? 'open' : 'closed';
	echo "Door {$i}: {$state}\n";
}
?>






Ada: with Ada.Text_Io; use Ada.Text_Io;
 
 procedure Doors is
    type Door_State is (Closed, Open);
    type Door_List is array(Positive range 1..100) of Door_State;
    The_Doors : Door_List := (others => Closed);
 begin
    for I in 1..100 loop
       for J in The_Doors'range loop
          if J mod I = 0 then
             if The_Doors(J) = Closed then
                 The_Doors(J) := Open;
             else
                The_Doors(J) := Closed;
             end if;
          end if;
       end loop;
    end loop;
    for I in The_Doors'range loop
       Put_Line(Integer'Image(I) & " is " & Door_State'Image(The_Doors(I)));
    end loop;
 end Doors;
Task: 100 doors






PHP: <?php
for ($i = 1; $i <= 100; $i++) {
	$root = sqrt($i);
	$state = ($root == ceil($root)) ? 'open' : 'closed';
	echo "Door {$i}: {$state}\n";
}
?>




COBOL:        IDENTIFICATION DIVISION.
       PROGRAM-ID. 100Doors.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 Current-n      PIC 9(3).
       01 StepSize       PIC 9(3).
       01 DoorTable.
          02 Doors       PIC 9(1)   OCCURS 100 TIMES.
             88 ClosedDoor          VALUE ZERO.
       01 Idx            PIC 9(3).

       PROCEDURE DIVISION.
       Begin.
           INITIALIZE DoorTable
           PERFORM VARYING StepSize FROM 1 BY 1 UNTIL StepSize > 100
             PERFORM VARYING Current-n FROM StepSize BY StepSize
                     UNTIL Current-n > 100
               SUBTRACT Doors (Current-n) FROM 1 GIVING Doors (Current-n)
             END-PERFORM
           END-PERFORM

           PERFORM VARYING Idx FROM 1 BY 1
                   UNTIL Idx > 100
             IF ClosedDoor (Idx)
               DISPLAY Idx " is closed."
             ELSE
               DISPLAY Idx " is open."
             END-IF
           END-PERFORM

           STOP RUN
           .
Task: Anti-primes



C#: using System;
using System.Linq;
using System.Collections.Generic;
					
public static class Program
{
    public static void Main() =>
        Console.WriteLine(string.Join(" ", FindAntiPrimes().Take(20)));
	
    static IEnumerable<int> FindAntiPrimes() {
        int max = 0;
        for (int i = 1; ; i++) {
            int divisors = CountDivisors(i);
            if (divisors > max) {
                max = divisors;
                yield return i;
            }
        }
	
        int CountDivisors(int n) => Enumerable.Range(1, n / 2).Count(i => n % i == 0) + 1;
    }
}









Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes

C: #include <stdio.h>

int countDivisors(int n) {
    int i, count;
    if (n < 2) return 1;
    count = 2; 
    for (i = 2; i <= n/2; ++i) {
        if (n%i == 0) ++count;
    }
    return count;
}

int main() {
    int n, d, maxDiv = 0, count = 0;
    printf("The first 20 anti-primes are:\n");
    for (n = 1; count < 20; ++n) {
        d = countDivisors(n); 
        if (d > maxDiv) {
            printf("%d ", n);
            maxDiv = d;
            count++;
        }
    }
    printf("\n"); 
    return 0;
}











Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes


C++: #include <iostream>

int countDivisors(int n) {
    if (n < 2) return 1;
    int count = 2; 
    for (int i = 2; i <= n/2; ++i) {
        if (n%i == 0) ++count;
    }
    return count;
}

int main() {
    int maxDiv = 0, count = 0;
    std::cout << "The first 20 anti-primes are:" << std::endl;
    for (int n = 1; count < 20; ++n) {
        int d = countDivisors(n);
        if (d > maxDiv) {
            std::cout << n << " ";
            maxDiv = d;
            count++;
        }
    }
    std::cout << std::endl;
    return 0;
}










Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes




Go: package main

import "fmt"

func countDivisors(n int) int {
    if n < 2 {
        return 1
    }
    count := 2 
    for i := 2; i <= n/2; i++ {
        if n%i == 0 {
            count++
        }
    }
    return count
}

func main() {
    fmt.Println("The first 20 anti-primes are:")
    maxDiv := 0
    count := 0
    for n := 1; count < 20; n++ {
        d := countDivisors(n)
        if d > maxDiv {
            fmt.Printf("%d ", n)
            maxDiv = d
            count++
        }
    }
    fmt.Println()
}








Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes





Java: public class Antiprime {

    static int countDivisors(int n) {
        if (n < 2) return 1;
        int count = 2; 
        for (int i = 2; i <= n/2; ++i) {
            if (n%i == 0) ++count;
        }
        return count;
    }

    public static void main(String[] args) {
        int maxDiv = 0, count = 0;
        System.out.println("The first 20 anti-primes are:");
        for (int n = 1; count < 20; ++n) {
            int d = countDivisors(n);
            if (d > maxDiv) {
                System.out.printf("%d ", n);
                maxDiv = d;
                count++;
            }
        }
        System.out.println();
    }
}







Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes







Python: from itertools import chain, count, cycle, islice, accumulate
 
def factors(n):
    def prime_powers(n):
        for c in accumulate(chain([2, 1, 2], cycle([2,4]))):
            if c*c > n: break
            if n%c: continue
            d,p = (), c
            while not n%c:
                n,p,d = n//c, p*c, d+(p,)
            yield d
        if n > 1: yield n,
 
    r = [1]
    for e in prime_powers(n):
        r += [a*b for a in r for b in e]
    return r
    
def antiprimes():
    mx = 0
    yield 1
    for c in count(2,2):
        if c >= 58: break
        ln = len(factors(c))
        if ln > mx:
            yield c
            mx = ln
    for c in count(60,30):
        ln = len(factors(c))
        if ln > mx:
            yield c
            mx = ln  

if __name__ == '__main__':
    print(*islice(antiprimes(), 40)))





Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes








VB: Dim Results(20)
Candidate = 1
max_divisors = 0

Print "Los primeros 20 anti-primos son:"
For j = 0 To 19
	Do
		divisors = count_divisors(Candidate)
		If max_divisors < divisors Then
			Results[j] = Candidate
			max_divisors = divisors
			Exit Do
		End If
		Candidate += 1
	Until false
	Print Results[j];" ";
Next j

Function count_divisors(n)
	cont = 1
	For i = 1 To n/2
		If (n % i) = 0 Then cont += 1
	Next i
	count_divisors = cont
End Function




Ada: with Ada.Text_IO; use Ada.Text_IO;

procedure Antiprimes is

   function Count_Divisors (N : Integer) return Integer is
      Count : Integer := 1;
   begin
      for i in 1 .. N / 2 loop
         if N mod i = 0 then
            Count := Count + 1;
         end if;
      end loop;
      return Count;
   end Count_Divisors;

   Results      : array (1 .. 20) of Integer;
   Candidate    : Integer := 1;
   Divisors     : Integer;
   Max_Divisors : Integer := 0;

begin
   for i in Results'Range loop
      loop
         Divisors := Count_Divisors (Candidate);
         if Max_Divisors < Divisors then
            Results (i)  := Candidate;
            Max_Divisors := Divisors;
            exit;
         end if;
         Candidate := Candidate + 1;
      end loop;
   end loop;
   Put_Line ("The first 20 anti-primes are:");
   for I in Results'Range loop
      Put (Integer'Image (Results (I)));
   end loop;
   New_Line;
end Antiprimes;
Task: Anti-primes

C: #include <stdio.h>

int countDivisors(int n) {
    int i, count;
    if (n < 2) return 1;
    count = 2; 
    for (i = 2; i <= n/2; ++i) {
        if (n%i == 0) ++count;
    }
    return count;
}

int main() {
    int n, d, maxDiv = 0, count = 0;
    printf("The first 20 anti-primes are:\n");
    for (n = 1; count < 20; ++n) {
        d = countDivisors(n); 
        if (d > maxDiv) {
            printf("%d ", n);
            maxDiv = d;
            count++;
        }
    }
    printf("\n"); 
    return 0;
}