kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Harshad or Niven series
C++: #include <vector>
#include <iostream>

int sumDigits ( int number ) {
   int sum = 0 ;
   while ( number != 0 ) {
      sum += number % 10 ;
      number /= 10 ;
   }
   return sum ;
}

bool isHarshad ( int number ) {
   return number % ( sumDigits ( number ) ) == 0 ;
}

int main( ) {
   std::vector<int> harshads ;
   int i = 0 ;
   while ( harshads.size( ) != 20 ) {
      i++ ;
      if ( isHarshad ( i ) ) 
	 harshads.push_back( i ) ;
   }
   std::cout << "The first 20 Harshad numbers:\n" ;
   for ( int number : harshads )
      std::cout << number << " " ;
   std::cout << std::endl ;
   int start = 1001 ;
   while ( ! ( isHarshad ( start ) ) ) 
      start++ ;
   std::cout << "The smallest Harshad number greater than 1000 : " << start << '\n' ;
   return 0 ;
}

Python: >>> import itertools
>>> def harshad():
	for n in itertools.count(1):
		if n % sum(int(ch) for ch in str(n)) == 0:
			yield n

		
>>> list(itertools.islice(harshad(), 0, 20))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 18, 20, 21, 24, 27, 30, 36, 40, 42]
>>> for n in harshad():
	if n > 1000:
		print(n)
		break

	
1002
>>>
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}

Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}
Task: Loops_N plus one half
C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}

Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half
C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}

Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}
Task: Loops_N plus one half
Python: print ( ', '.join(str(i+1) for i in range(10)) )

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}
Task: Loops_N plus one half
C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}

Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}
Task: Loops_N plus one half
Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}

Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}
Task: Loops_N plus one half
Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}

Python: print ( ', '.join(str(i+1) for i in range(10)) )
Task: Loops_N plus one half
Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}

VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub
Task: Loops_N plus one half
C: #include <stdio.h>

int main()
{
  int i;
  for (i = 1; i <= 10; i++) {
    printf("%d", i);
    printf(i == 10 ? "\n" : ", ");
  }
  return 0;
}

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
C#: using System;

class Program
{
    static void Main(string[] args)
    {
        for (int i = 1; ; i++)
        {
            Console.Write(i);
            if (i == 10) break;
            Console.Write(", ");
        }
        Console.WriteLine();
    }
}

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
C++: #include <iostream>
 
int main()
{ 
  int i;
  for (i = 1; i<=10 ; i++){
    std::cout << i;
    if (i < 10)
     std::cout << ", ";
  }
  return 0;
}

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
Go: package main

import "fmt"

func main() {
    for i := 1; ; i++ {
        fmt.Print(i)
        if i == 10 {
            fmt.Println()
            break
        }
        fmt.Print(", ")
    }
}

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
Java: var out = System.out
for(i in 1..10) {
  if(i > 1) out.print(", ")
  out.print(i)
}

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
Python: print ( ', '.join(str(i+1) for i in range(10)) )

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: Loops_N plus one half
VB: Public Sub WriteACommaSeparatedList()
    Dim i As Integer
    Dim a(1 To 10) As String
    For i = 1 To 10
        a(i) = CStr(i)
    Next i
    Debug.Print Join(a, ", ")
End Sub

PHP: for ($i = 1; $i <= 11; $i++) {
    echo $i;
    if ($i == 10)
        break;
    echo ', ';
}
echo "\n";
Task: 10001th prime
C: #include<stdio.h>
#include<stdlib.h>

int isprime( int p ) {
    int i;
    if(p==2) return 1;
    if(!(p%2)) return 0;
    for(i=3; i*i<=p; i+=2) {
       if(!(p%i)) return 0;
    }
    return 1;
}

int prime( int n ) {
    int p, pn=1;
    if(n==1) return 2;
    for(p=3;pn<n;p+=2) {
        if(isprime(p)) pn++;
    }
    return p-2;
}

int main(void) {
    printf( "%d\n", prime(10001) );
    return 0;
}

C#: using System; class Program {

  static bool isprime(uint p ) { if ((p & 1) == 0) return p == 2;
    if ((p % 3) == 0) return p == 3;
    for (uint i = 5, d = 4; i * i <= p; i += (d = 6 - d))
      if (p % i == 0) return false; return true; }
 
  static uint prime(uint n) { uint p, d, pn;
    for (p = 5, d = 4, pn = 2; pn < n; p += (d = 6 - d))
      if (isprime(p)) pn++; return p - d; }

  static void Main(string[] args) {
    Console.WriteLine("One-at-a-time trial division vs sieve of Eratosthenes");
    var sw = System.Diagnostics.Stopwatch.StartNew();
    var t = prime(10001); sw.Stop(); double e1, e2;
    Console.Write("{0:n0} {1} ms", prime(10001),
      e1 = sw.Elapsed.TotalMilliseconds);
    sw.Restart(); uint n = 105000, i, j; var pr = new uint[10100];
    pr[0] = 2; pr[1] = 3; uint pc = 2, r, d, ii;
    var pl = new bool[n + 1]; r = (uint)Math.Sqrt(n);
    for (i = 9; i < n; i += 6) pl[i] = true;
    for (i = 5, d = 4; i <= r; i += (d = 6 - d)) if (!pl[i]) {
      pr[pc++] = i; for (j = i * i, ii = i << 1; j <= n; j += ii)
        pl[j] = true; }
    for ( ;i <= n; i += (d = 6 - d)) if (!pl[i]) pr[pc++] = i;
    t = pr[10000]; sw.Stop();
    Console.Write("  {0:n0} {1} μs  {2:0.000} times faster", t,
      (e2 = sw.Elapsed.TotalMilliseconds) * 1000.0, e1 / e2); } }
Task: 10001th prime
C: #include<stdio.h>
#include<stdlib.h>

int isprime( int p ) {
    int i;
    if(p==2) return 1;
    if(!(p%2)) return 0;
    for(i=3; i*i<=p; i+=2) {
       if(!(p%i)) return 0;
    }
    return 1;
}

int prime( int n ) {
    int p, pn=1;
    if(n==1) return 2;
    for(p=3;pn<n;p+=2) {
        if(isprime(p)) pn++;
    }
    return p-2;
}

int main(void) {
    printf( "%d\n", prime(10001) );
    return 0;
}

C++: #include <iostream>
#include <locale>

#include <primesieve.hpp>

int main() {
    std::cout.imbue(std::locale(""));
    std::cout << "The 10,001st prime is " << primesieve::nth_prime(10001) << ".\n";
}
Task: 10001th prime
C: #include<stdio.h>
#include<stdlib.h>

int isprime( int p ) {
    int i;
    if(p==2) return 1;
    if(!(p%2)) return 0;
    for(i=3; i*i<=p; i+=2) {
       if(!(p%i)) return 0;
    }
    return 1;
}

int prime( int n ) {
    int p, pn=1;
    if(n==1) return 2;
    for(p=3;pn<n;p+=2) {
        if(isprime(p)) pn++;
    }
    return p-2;
}

int main(void) {
    printf( "%d\n", prime(10001) );
    return 0;
}

Java: public class NthPrime {
    public static void main(String[] args) {
        System.out.printf("The 10,001st prime is %,d.\n", nthPrime(10001));
    }

    private static int nthPrime(int n) {
        assert n > 0;
        PrimeGenerator primeGen = new PrimeGenerator(10000, 100000);
        int prime = primeGen.nextPrime();
        while (--n > 0)
            prime = primeGen.nextPrime();
        return prime;
    }
}
Task: 10001th prime
C: #include<stdio.h>
#include<stdlib.h>

int isprime( int p ) {
    int i;
    if(p==2) return 1;
    if(!(p%2)) return 0;
    for(i=3; i*i<=p; i+=2) {
       if(!(p%i)) return 0;
    }
    return 1;
}

int prime( int n ) {
    int p, pn=1;
    if(n==1) return 2;
    for(p=3;pn<n;p+=2) {
        if(isprime(p)) pn++;
    }
    return p-2;
}

int main(void) {
    printf( "%d\n", prime(10001) );
    return 0;
}

Python: 

def isPrime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False        
    return True

def prime(n: int) -> int:
    if n == 1:
        return 2
    p = 3
    pn = 1
    while pn < n:
        if isPrime(p):
            pn += 1
        p += 2
    return p-2

if __name__ == '__main__':
    print(prime(10001))
Task: 10001th prime
C#: using System; class Program {

  static bool isprime(uint p ) { if ((p & 1) == 0) return p == 2;
    if ((p % 3) == 0) return p == 3;
    for (uint i = 5, d = 4; i * i <= p; i += (d = 6 - d))
      if (p % i == 0) return false; return true; }
 
  static uint prime(uint n) { uint p, d, pn;
    for (p = 5, d = 4, pn = 2; pn < n; p += (d = 6 - d))
      if (isprime(p)) pn++; return p - d; }

  static void Main(string[] args) {
    Console.WriteLine("One-at-a-time trial division vs sieve of Eratosthenes");
    var sw = System.Diagnostics.Stopwatch.StartNew();
    var t = prime(10001); sw.Stop(); double e1, e2;
    Console.Write("{0:n0} {1} ms", prime(10001),
      e1 = sw.Elapsed.TotalMilliseconds);
    sw.Restart(); uint n = 105000, i, j; var pr = new uint[10100];
    pr[0] = 2; pr[1] = 3; uint pc = 2, r, d, ii;
    var pl = new bool[n + 1]; r = (uint)Math.Sqrt(n);
    for (i = 9; i < n; i += 6) pl[i] = true;
    for (i = 5, d = 4; i <= r; i += (d = 6 - d)) if (!pl[i]) {
      pr[pc++] = i; for (j = i * i, ii = i << 1; j <= n; j += ii)
        pl[j] = true; }
    for ( ;i <= n; i += (d = 6 - d)) if (!pl[i]) pr[pc++] = i;
    t = pr[10000]; sw.Stop();
    Console.Write("  {0:n0} {1} μs  {2:0.000} times faster", t,
      (e2 = sw.Elapsed.TotalMilliseconds) * 1000.0, e1 / e2); } }

C++: #include <iostream>
#include <locale>

#include <primesieve.hpp>

int main() {
    std::cout.imbue(std::locale(""));
    std::cout << "The 10,001st prime is " << primesieve::nth_prime(10001) << ".\n";
}
Task: 10001th prime
C++: #include <iostream>
#include <locale>

#include <primesieve.hpp>

int main() {
    std::cout.imbue(std::locale(""));
    std::cout << "The 10,001st prime is " << primesieve::nth_prime(10001) << ".\n";
}

Java: public class NthPrime {
    public static void main(String[] args) {
        System.out.printf("The 10,001st prime is %,d.\n", nthPrime(10001));
    }

    private static int nthPrime(int n) {
        assert n > 0;
        PrimeGenerator primeGen = new PrimeGenerator(10000, 100000);
        int prime = primeGen.nextPrime();
        while (--n > 0)
            prime = primeGen.nextPrime();
        return prime;
    }
}
Task: 10001th prime
C++: #include <iostream>
#include <locale>

#include <primesieve.hpp>

int main() {
    std::cout.imbue(std::locale(""));
    std::cout << "The 10,001st prime is " << primesieve::nth_prime(10001) << ".\n";
}

Python: 

def isPrime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False        
    return True

def prime(n: int) -> int:
    if n == 1:
        return 2
    p = 3
    pn = 1
    while pn < n:
        if isPrime(p):
            pn += 1
        p += 2
    return p-2

if __name__ == '__main__':
    print(prime(10001))
Task: 10001th prime
C#: using System; class Program {

  static bool isprime(uint p ) { if ((p & 1) == 0) return p == 2;
    if ((p % 3) == 0) return p == 3;
    for (uint i = 5, d = 4; i * i <= p; i += (d = 6 - d))
      if (p % i == 0) return false; return true; }
 
  static uint prime(uint n) { uint p, d, pn;
    for (p = 5, d = 4, pn = 2; pn < n; p += (d = 6 - d))
      if (isprime(p)) pn++; return p - d; }

  static void Main(string[] args) {
    Console.WriteLine("One-at-a-time trial division vs sieve of Eratosthenes");
    var sw = System.Diagnostics.Stopwatch.StartNew();
    var t = prime(10001); sw.Stop(); double e1, e2;
    Console.Write("{0:n0} {1} ms", prime(10001),
      e1 = sw.Elapsed.TotalMilliseconds);
    sw.Restart(); uint n = 105000, i, j; var pr = new uint[10100];
    pr[0] = 2; pr[1] = 3; uint pc = 2, r, d, ii;
    var pl = new bool[n + 1]; r = (uint)Math.Sqrt(n);
    for (i = 9; i < n; i += 6) pl[i] = true;
    for (i = 5, d = 4; i <= r; i += (d = 6 - d)) if (!pl[i]) {
      pr[pc++] = i; for (j = i * i, ii = i << 1; j <= n; j += ii)
        pl[j] = true; }
    for ( ;i <= n; i += (d = 6 - d)) if (!pl[i]) pr[pc++] = i;
    t = pr[10000]; sw.Stop();
    Console.Write("  {0:n0} {1} μs  {2:0.000} times faster", t,
      (e2 = sw.Elapsed.TotalMilliseconds) * 1000.0, e1 / e2); } }

Python: 

def isPrime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False        
    return True

def prime(n: int) -> int:
    if n == 1:
        return 2
    p = 3
    pn = 1
    while pn < n:
        if isPrime(p):
            pn += 1
        p += 2
    return p-2

if __name__ == '__main__':
    print(prime(10001))
Task: 10001th prime
Java: public class NthPrime {
    public static void main(String[] args) {
        System.out.printf("The 10,001st prime is %,d.\n", nthPrime(10001));
    }

    private static int nthPrime(int n) {
        assert n > 0;
        PrimeGenerator primeGen = new PrimeGenerator(10000, 100000);
        int prime = primeGen.nextPrime();
        while (--n > 0)
            prime = primeGen.nextPrime();
        return prime;
    }
}

Python: 

def isPrime(n):
    for i in range(2, int(n**0.5) + 1):
        if n % i == 0:
            return False        
    return True

def prime(n: int) -> int:
    if n == 1:
        return 2
    p = 3
    pn = 1
    while pn < n:
        if isPrime(p):
            pn += 1
        p += 2
    return p-2

if __name__ == '__main__':
    print(prime(10001))
Task: 10001th prime
C#: using System; class Program {

  static bool isprime(uint p ) { if ((p & 1) == 0) return p == 2;
    if ((p % 3) == 0) return p == 3;
    for (uint i = 5, d = 4; i * i <= p; i += (d = 6 - d))
      if (p % i == 0) return false; return true; }
 
  static uint prime(uint n) { uint p, d, pn;
    for (p = 5, d = 4, pn = 2; pn < n; p += (d = 6 - d))
      if (isprime(p)) pn++; return p - d; }

  static void Main(string[] args) {
    Console.WriteLine("One-at-a-time trial division vs sieve of Eratosthenes");
    var sw = System.Diagnostics.Stopwatch.StartNew();
    var t = prime(10001); sw.Stop(); double e1, e2;
    Console.Write("{0:n0} {1} ms", prime(10001),
      e1 = sw.Elapsed.TotalMilliseconds);
    sw.Restart(); uint n = 105000, i, j; var pr = new uint[10100];
    pr[0] = 2; pr[1] = 3; uint pc = 2, r, d, ii;
    var pl = new bool[n + 1]; r = (uint)Math.Sqrt(n);
    for (i = 9; i < n; i += 6) pl[i] = true;
    for (i = 5, d = 4; i <= r; i += (d = 6 - d)) if (!pl[i]) {
      pr[pc++] = i; for (j = i * i, ii = i << 1; j <= n; j += ii)
        pl[j] = true; }
    for ( ;i <= n; i += (d = 6 - d)) if (!pl[i]) pr[pc++] = i;
    t = pr[10000]; sw.Stop();
    Console.Write("  {0:n0} {1} μs  {2:0.000} times faster", t,
      (e2 = sw.Elapsed.TotalMilliseconds) * 1000.0, e1 / e2); } }

Java: public class NthPrime {
    public static void main(String[] args) {
        System.out.printf("The 10,001st prime is %,d.\n", nthPrime(10001));
    }

    private static int nthPrime(int n) {
        assert n > 0;
        PrimeGenerator primeGen = new PrimeGenerator(10000, 100000);
        int prime = primeGen.nextPrime();
        while (--n > 0)
            prime = primeGen.nextPrime();
        return prime;
    }
}
Task: 10001th prime
C: #include<stdio.h>
#include<stdlib.h>

int isprime( int p ) {
    int i;
    if(p==2) return 1;
    if(!(p%2)) return 0;
    for(i=3; i*i<=p; i+=2) {
       if(!(p%i)) return 0;
    }
    return 1;
}

int prime( int n ) {
    int p, pn=1;
    if(n==1) return 2;
    for(p=3;pn<n;p+=2) {
        if(isprime(p)) pn++;
    }
    return p-2;
}

int main(void) {
    printf( "%d\n", prime(10001) );
    return 0;
}

C#: #include <iostream>
#include <locale>

#include <primesieve.hpp>

int main() {
    std::cout.imbue(std::locale(""));
    std::cout << "The 10,001st prime is " << primesieve::nth_prime(10001) << ".\n";
}