WeixiangYan/CodeTransOcean huggingface dataset:
Task: Real constants and functions


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

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}
Task: Real constants and functions





Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y);
Task: Real constants and functions







Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])
Task: Real constants and functions








VB: Public Sub Main() 
  
  Dim e As Float = Exp(1) 
  
  Print "e     = "; e 
  Print "π     = "; Pi 
  Dim x As Float = 12.345 
  Dim y As Float = 1.23 
  Print "sqrt  = "; Sqr(x)
  Print "ln    = "; Log(x)
  Print "log10 = "; Log(x) / Log(10) 
  Print "log   = "; Log(x) / Log(y)
  Print "exp   = "; Exp(x)          
  Print "abs   = "; Abs(-x)
  Print "floor = "; Floor(x)
  Print "ceil  = "; Ceil(x)
  Print "power = "; x ^ y 
  
End
Task: Real constants and functions




Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}
Task: Real constants and functions



C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}








Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions


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

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}









Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions

C: #include <math.h>

M_E; 
M_PI; 
sqrt(x); 
log(x); 
exp(x); 
abs(x); 
fabs(x); 
floor(x); 
ceil(x); 
pow(x,y); 










Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions




Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}







Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions





Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y); 






Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions







Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])  







Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions






PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power





Fortran:  e          
 pi         
 SQRT(x)    
 LOG(x)     
 LOG10(x)   
 EXP(x)     
 ABS(x)     
 FLOOR(x)   
 CEILING(x) 
 x**y
Task: Real constants and functions

C: #include <math.h>

M_E; 
M_PI; 
sqrt(x); 
log(x); 
exp(x); 
abs(x); 
fabs(x); 
floor(x); 
ceil(x); 
pow(x,y); 









COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions



C#: using System;

class Program {
    static void Main(string[] args) {        
        Console.WriteLine(Math.E); 
        Console.WriteLine(Math.PI); 
        Console.WriteLine(Math.Sqrt(10)); 
        Console.WriteLine(Math.Log(10)); 
        Console.WriteLine(Math.Log10(10)); 
        Console.WriteLine(Math.Exp(10)); 
        Console.WriteLine(Math.Abs(10)); 
        Console.WriteLine(Math.Floor(10.0)); 
        Console.WriteLine(Math.Ceiling(10.0)); 
        Console.WriteLine(Math.Pow(2, 5)); 
    }
}







COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions


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

#ifdef M_E
static double euler_e = M_E;
#else
static double euler_e = std::exp(1); 
#endif

#ifdef M_PI
static double pi = M_PI;
#else
static double pi = std::acos(-1);
#endif

int main()
{
  std::cout << "e = " << euler_e
            << "\npi = " << pi
            << "\nsqrt(2) = " << std::sqrt(2.0)
            << "\nln(e) = " << std::log(euler_e)
            << "\nlg(100) = " << std::log10(100.0)
            << "\nexp(3) = " << std::exp(3.0)
            << "\n|-4.5| = " << std::abs(-4.5)   
            << "\nfloor(4.5) = " << std::floor(4.5)
            << "\nceiling(4.5) = " << std::ceil(4.5)
            << "\npi^2 = " << std::pow(pi,2.0) << std::endl;
}








COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions





Java: Math.E; 
Math.PI; 
Math.sqrt(x); 
Math.log(x); 
Math.exp(x); 
Math.abs(x); 
Math.floor(x); 
Math.ceil(x); 
Math.pow(x,y); 





COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions







Python: import math

math.e          
math.pi         
math.sqrt(x)    
math.log(x)     
math.log10(x)   
math.exp(x)     
abs(x)          
math.floor(x)   
math.ceil(x)    
x ** y          
pow(x, y[, n])  






COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions








VB: Public Sub Main() 
  
  Dim e As Float = Exp(1) 
  
  Print "e     = "; e 
  Print "π     = "; Pi 
  Dim x As Float = 12.345 
  Dim y As Float = 1.23 
  Print "sqrt  = "; Sqr(x)
  Print "ln    = "; Log(x)
  Print "log10 = "; Log(x) / Log(10) 
  Print "log   = "; Log(x) / Log(y)
  Print "exp   = "; Exp(x)          
  Print "abs   = "; Abs(-x)
  Print "floor = "; Floor(x)
  Print "ceil  = "; Ceil(x)
  Print "power = "; x ^ y 
  
End


COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions




Go: package main

import (
    "fmt"
    "math"
    "math/big"
)

func main() {
    
    
    
    fmt.Println("float64 values:")
    fmt.Println("e:", math.E)
    fmt.Println("π:", math.Pi)

    

    
    fmt.Println("square root(1.44):", math.Sqrt(1.44))
    
    
    
    fmt.Println("ln(e):", math.Log(math.E))
    
    fmt.Println("exponential(1):", math.Exp(1))
    fmt.Println("absolute value(-1.2):", math.Abs(-1.2))
    fmt.Println("floor(-1.2):", math.Floor(-1.2))
    fmt.Println("ceiling(-1.2):", math.Ceil(-1.2))
    fmt.Println("power(1.44, .5):", math.Pow(1.44, .5))

    
    
    fmt.Println("\nfloat32 values:")
    fmt.Println("e:", float32(math.E))
    fmt.Println("π:", float32(math.Pi))

    
    
    
    
    
    
    
    pi := "3.141592653589793238462643383279502884197169399375105820974944"
    π, _, _ := big.ParseFloat(pi, 10, 200, 0)
    fmt.Println("\nbig.Float values:")
    fmt.Println("π:", π)
    
    x := new(big.Float).Neg(π)
    y := new(big.Float)
    fmt.Println("x:", x)
    fmt.Println("abs(x):", y.Abs(x))
}






COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Real constants and functions






PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power
Task: Real constants and functions






PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power






Ada: Ada.Numerics.e  
Ada.Numerics.pi 
sqrt(x)         
log(x, base)    
exp(x)          
abs(x)          
S'floor(x)      
S'ceiling(x)    
x**y
Task: Real constants and functions






PHP: M_E; //e
M_PI; //pi
sqrt(x); //square root
log(x); //natural logarithm--log base 10 also available (log10)
exp(x); //exponential
abs(x); //absolute value
floor(x); //floor
ceil(x); //ceiling
pow(x,y); //power




COBOL: E          
PI         
SQRT(n)    
LOG(n)     
LOG10(n)   
EXP(n)     
ABS(n)     
INTEGER(n) 

ADD 1 TO N
MOVE INTEGER(N) TO Result

COMPUTE Result = N ** 2
Task: Singly-linked list_Element definition



C#: class LinkedListNode
{
    public int Value { get; set; }
    public LinkedListNode Next { get; set; }

    
    public Link(int value, LinkedListNode next = null)
    {
        Item = value;
        Next = next;
    }
}









Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition

C: struct link {
  struct link *next;
  int data;
};











Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition


C++: struct link
{
  link* next;
  int data;
};










Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition




Go: type Ele struct {
    Data interface{}
    Next *Ele
}

func (e *Ele) Append(data interface{}) *Ele {
    if e.Next == nil {
        e.Next = &Ele{data, nil}
    } else {
        tmp := &Ele{data, e.Next}
        e.Next = tmp
    }
    return e.Next
}

func (e *Ele) String() string {
    return fmt.Sprintf("Ele: %v", e.Data)
}








Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition





Java: class Link
{
    Link next;
    int data;
}







Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition







Python: class LinkedList(object):
     
	class Node(object):
		def __init__(self, item):
			self.value  = item
			self.next = None
	def __init__(self, item=None):
		if item is not None:
			self.head = Node(item); self.tail = self.head
		else:
			self.head = None; self.tail = None
	def append(self, item):
		if not self.head:
			self.head = Node(item)
			self.tail = self.head
		elif self.tail:
			self.tail.next = Node(item)
			self.tail = self.tail.next
		else:
			self.tail = Node(item)
	def __iter__(self):
		cursor = self.head
		while cursor:
			yield cursor.value
			cursor = cursor.next





Ada: type Link;
type Link_Access is access Link;
type Link is record
   Next : Link_Access := null;
   Data : Integer;
end record;
Task: Singly-linked list_Element definition



C#: class LinkedListNode
{
    public int Value { get; set; }
    public LinkedListNode Next { get; set; }

    
    public Link(int value, LinkedListNode next = null)
    {
        Item = value;
        Next = next;
    }
}
Task: Singly-linked list_Element definition







Python: class LinkedList(object):
     
	class Node(object):
		def __init__(self, item):
			self.value  = item
			self.next = None
	def __init__(self, item=None):
		if item is not None:
			self.head = Node(item); self.tail = self.head
		else:
			self.head = None; self.tail = None
	def append(self, item):
		if not self.head:
			self.head = Node(item)
			self.tail = self.head
		elif self.tail:
			self.tail.next = Node(item)
			self.tail = self.tail.next
		else:
			self.tail = Node(item)
	def __iter__(self):
		cursor = self.head
		while cursor:
			yield cursor.value
			cursor = cursor.next
Task: Singly-linked list_Element definition




Go: type Ele struct {
    Data interface{}
    Next *Ele
}

func (e *Ele) Append(data interface{}) *Ele {
    if e.Next == nil {
        e.Next = &Ele{data, nil}
    } else {
        tmp := &Ele{data, e.Next}
        e.Next = tmp
    }
    return e.Next
}

func (e *Ele) String() string {
    return fmt.Sprintf("Ele: %v", e.Data)
}
Task: Singly-linked list_Element definition

C: struct link {
  struct link *next;
  int data;
};
Task: Singly-linked list_Element definition


C++: struct link
{
  link* next;
  int data;
};
Task: Singly-linked list_Element definition





Java: class Link
{
    Link next;
    int data;
}
Task: Singly-linked list_Element definition



C#: class LinkedListNode
{
    public int Value { get; set; }
    public LinkedListNode Next { get; set; }

    
    public Link(int value, LinkedListNode next = null)
    {
        Item = value;
        Next = next;
    }
}








Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Singly-linked list_Element definition


C++: struct link
{
  link* next;
  int data;
};









Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Singly-linked list_Element definition

C: struct link {
  struct link *next;
  int data;
};










Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Singly-linked list_Element definition




Go: type Ele struct {
    Data interface{}
    Next *Ele
}

func (e *Ele) Append(data interface{}) *Ele {
    if e.Next == nil {
        e.Next = &Ele{data, nil}
    } else {
        tmp := &Ele{data, e.Next}
        e.Next = tmp
    }
    return e.Next
}

func (e *Ele) String() string {
    return fmt.Sprintf("Ele: %v", e.Data)
}







Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Singly-linked list_Element definition





Java: class Link
{
    Link next;
    int data;
}






Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Singly-linked list_Element definition







Python: class LinkedList(object):
     
	class Node(object):
		def __init__(self, item):
			self.value  = item
			self.next = None
	def __init__(self, item=None):
		if item is not None:
			self.head = Node(item); self.tail = self.head
		else:
			self.head = None; self.tail = None
	def append(self, item):
		if not self.head:
			self.head = Node(item)
			self.tail = self.head
		elif self.tail:
			self.tail.next = Node(item)
			self.tail = self.tail.next
		else:
			self.tail = Node(item)
	def __iter__(self):
		cursor = self.head
		while cursor:
			yield cursor.value
			cursor = cursor.next




Fortran: type node
   real :: data
   type( node ), pointer :: next => null() 
end type node



type( node ) :: head
Task: Pell's equation



C#: using System;
using System.Numerics;

static class Program
{
    static void Fun(ref BigInteger a, ref BigInteger b, int c)
    {
        BigInteger t = a; a = b; b = b * c + t;
    }

    static void SolvePell(int n, ref BigInteger a, ref BigInteger b)
    {
        int x = (int)Math.Sqrt(n), y = x, z = 1, r = x << 1;
        BigInteger e1 = 1, e2 = 0, f1 = 0, f2 = 1;
        while (true)
        {
            y = r * z - y; z = (n - y * y) / z; r = (x + y) / z;
            Fun(ref e1, ref e2, r); Fun(ref f1, ref f2, r); a = f2; b = e2; Fun(ref b, ref a, x);
            if (a * a - n * b * b == 1) return;
        }
    }

    static void Main()
    {
        BigInteger x, y; foreach (int n in new[] { 61, 109, 181, 277 })
        {
            SolvePell(n, ref x, ref y);
            Console.WriteLine("x^2 - {0,3} * y^2 = 1 for x = {1,27:n0} and y = {2,25:n0}", n, x, y);
        }
    }
}









Ada: with Ada.Text_Io;
with Ada.Numerics.Elementary_Functions;
with Ada.Numerics.Big_Numbers.Big_Integers;

procedure Pells_Equation is
   use Ada.Numerics.Big_Numbers.Big_Integers;

   type Pair is
      record
         V1, V2 : Big_Integer;
      end record;

   procedure Solve_Pell (N : Natural; X, Y : out Big_Integer) is
      use Ada.Numerics.Elementary_Functions;
      Big_N : constant Big_Integer := To_Big_Integer (N);
      XX    : constant Big_Integer := To_Big_Integer (Natural (Float'Floor (Sqrt (Float (N)))));
   begin
      if XX**2 = Big_N then
         X := 1; Y := 0;
         return;
      end if;

      declare
         YY   : Big_Integer := XX;
         Z    : Big_Integer := 1;
         R    : Big_Integer := 2 * XX;
         E    : Pair        := Pair'(V1 => 1, V2 => 0);
         F    : Pair        := Pair'(V1 => 0, V2 => 1);
      begin
         loop
            YY := R * Z - YY;
            Z  := (Big_N - YY**2) / Z;
            R  := (XX + YY) / Z;
            E  := Pair'(V1 => E.V2, V2 => R * E.V2 + E.V1);
            F  := Pair'(V1 => F.V2, V2 => R * F.V2 + F.V1);
            X  := E.V2 + XX * F.V2;
            Y  := F.V2;
            exit when X**2 - Big_N * Y**2 = 1;
         end loop;
      end;
   end Solve_Pell;

   procedure Test (N : Natural) is

      package Natural_Io is new Ada.Text_Io.Integer_Io (Natural);
      use Ada.Text_Io, Natural_Io;

      X, Y : Big_Integer;
   begin
      Solve_Pell (N, X => X, Y => Y);
      Put ("X**2 - ");
      Put (N, Width => 3);
      Put (" * Y**2 = 1 for X = ");
      Put (To_String (X, Width => 22));
      Put (" and Y = ");
      Put (To_String (Y, Width => 20));
      New_Line;
   end Test;

begin
   Test (61);
   Test (109);
   Test (181);
   Test (277);
end Pells_Equation;