kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Integer roots
C: #include <stdio.h>
#include <math.h>

typedef unsigned long long ulong;

ulong root(ulong base, ulong n) {
    ulong n1, n2, n3, c, d, e;

    if (base < 2) return base;
    if (n == 0) return 1;

    n1 = n - 1;
    n2 = n;
    n3 = n1;
    c = 1;
    d = (n3 + base) / n2;
    e = (n3 * d + base / (ulong)powl(d, n1)) / n2;

    while (c != d && c != e) {
        c = d;
        d = e;
        e = (n3*e + base / (ulong)powl(e, n1)) / n2;
    }

    if (d < e) return d;
    return e;
}

int main() {
    ulong b = (ulong)2e18;

    printf("3rd root of 8 = %lld\n", root(8, 3));
    printf("3rd root of 9 = %lld\n", root(9, 3));
    printf("2nd root of %lld = %lld\n", b, root(b, 2));

    return 0;
}

Java: import java.math.BigInteger;

public class IntegerRoots {
    private static BigInteger iRoot(BigInteger base, int n) {
        if (base.compareTo(BigInteger.ZERO) < 0 || n <= 0) {
            throw new IllegalArgumentException();
        }

        int n1 = n - 1;
        BigInteger n2 = BigInteger.valueOf(n);
        BigInteger n3 = BigInteger.valueOf(n1);
        BigInteger c = BigInteger.ONE;
        BigInteger d = n3.add(base).divide(n2);
        BigInteger e = n3.multiply(d).add(base.divide(d.pow(n1))).divide(n2);
        while (!c.equals(d) && !c.equals(e)) {
            c = d;
            d = e;
            e = n3.multiply(e).add(base.divide(e.pow(n1))).divide(n2);
        }
        if (d.compareTo(e) < 0) {
            return d;
        }
        return e;
    }

    public static void main(String[] args) {
        BigInteger b = BigInteger.valueOf(8);
        System.out.print("3rd integer root of 8 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(9);
        System.out.print("3rd integer root of 9 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(100).pow(2000).multiply(BigInteger.valueOf(2));
        System.out.print("First 2001 digits of the square root of 2: ");
        System.out.println(iRoot(b, 2));
    }
}
Task: Integer roots
C: #include <stdio.h>
#include <math.h>

typedef unsigned long long ulong;

ulong root(ulong base, ulong n) {
    ulong n1, n2, n3, c, d, e;

    if (base < 2) return base;
    if (n == 0) return 1;

    n1 = n - 1;
    n2 = n;
    n3 = n1;
    c = 1;
    d = (n3 + base) / n2;
    e = (n3 * d + base / (ulong)powl(d, n1)) / n2;

    while (c != d && c != e) {
        c = d;
        d = e;
        e = (n3*e + base / (ulong)powl(e, n1)) / n2;
    }

    if (d < e) return d;
    return e;
}

int main() {
    ulong b = (ulong)2e18;

    printf("3rd root of 8 = %lld\n", root(8, 3));
    printf("3rd root of 9 = %lld\n", root(9, 3));
    printf("2nd root of %lld = %lld\n", b, root(b, 2));

    return 0;
}

VB: Imports System
Imports System.Numerics
Imports Microsoft.VisualBasic.Strings

Public Module Module1

    Public Function IntSqRoot(v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / 2 - 1)
        IntSqRoot = BigInteger.Parse("3" & StrDup(digs, "0"))
        Dim term As BigInteger
        Do
            term = v / IntSqRoot
            If Math.Abs(CDbl(term - IntSqRoot)) < 2 Then Exit Do
            IntSqRoot = (IntSqRoot + term) / 2
        Loop Until False
    End Function

    Public Function IntNthRoot(n As Integer, v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / n - 1)
        IntNthRoot = BigInteger.Parse(If(digs > 1, 3, 2).ToString() & StrDup(digs, "0"))
        Dim va As BigInteger, dr As BigInteger
        Do
            va = v : For i As Integer = 2 To n : va /= IntNthRoot : Next
            va -= IntNthRoot
            dr = va / n : If dr = 0 Then Exit Do
            IntNthRoot += dr
        Loop Until False
    End Function

    Public Sub Main()
        Dim b As BigInteger = BigInteger.Parse("2" & StrDup(4008, "0"))
        Console.WriteLine("Integer Cube Root of 8:")
        Console.WriteLine(IntNthRoot(3, 8).ToString()) 
        Console.WriteLine("Integer Cube Root of 9:")
        Console.WriteLine(IntNthRoot(3, 9).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, square root method):")
        Console.WriteLine(IntSqRoot(b).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, nth root method):")
        Console.WriteLine(IntNthRoot(2, b).ToString()) 
        Console.WriteLine("Integer Cube Root of 2, (actually 2 * 10 ^ 4008):")
        Console.WriteLine(IntNthRoot(3, b).ToString()) 
        b /= 10000
        Console.WriteLine("Integer 7th Root of 2, (actually 2 * 10 ^ 4004):")
        Console.WriteLine(IntNthRoot(7, b).ToString()) 
        If Diagnostics.Debugger.IsAttached Then Console.Read()
    End Sub

End Module
Task: Integer roots
C#: using System;
using System.Numerics;

namespace IntegerRoots {
    class Program {
        static BigInteger IRoot(BigInteger @base, int n) {
            if (@base < 0 || n <= 0) {
                throw new ArgumentException();
            }

            int n1 = n - 1;
            BigInteger n2 = n;
            BigInteger n3 = n1;
            BigInteger c = 1;
            BigInteger d = (n3 + @base) / n2;
            BigInteger e = ((n3 * d) + (@base / BigInteger.Pow(d, n1))) / n2;
            while (c != d && c != e) {
                c = d;
                d = e;
                e = (n3 * e + @base / BigInteger.Pow(e, n1)) / n2;
            }
            if (d < e) {
                return d;
            }
            return e;
        }

        static void Main(string[] args) {
            Console.WriteLine("3rd integer root of 8 = {0}", IRoot(8, 3));
            Console.WriteLine("3rd integer root of 9 = {0}", IRoot(9, 3));

            BigInteger b = BigInteger.Pow(100, 2000) * 2;
            Console.WriteLine("First 2001 digits of the sqaure root of 2: {0}", IRoot(b, 2));
        }
    }
}

Go: package main

import "fmt"

func main() {
    fmt.Println(root(3, 8))
    fmt.Println(root(3, 9))
    fmt.Println(root(2, 2e18))
}

func root(N, X int) int {
    
    for r := 1; ; {
        x := X
        for i := 1; i < N; i++ {
            x /= r
        }
        x -= r
        
        
        
        
        Δr := x / N
        if x%N < 0 {
            Δr--
        }
        if Δr == 0 {
            return r
        }
        r += Δr
    }
}
Task: Integer roots
C#: using System;
using System.Numerics;

namespace IntegerRoots {
    class Program {
        static BigInteger IRoot(BigInteger @base, int n) {
            if (@base < 0 || n <= 0) {
                throw new ArgumentException();
            }

            int n1 = n - 1;
            BigInteger n2 = n;
            BigInteger n3 = n1;
            BigInteger c = 1;
            BigInteger d = (n3 + @base) / n2;
            BigInteger e = ((n3 * d) + (@base / BigInteger.Pow(d, n1))) / n2;
            while (c != d && c != e) {
                c = d;
                d = e;
                e = (n3 * e + @base / BigInteger.Pow(e, n1)) / n2;
            }
            if (d < e) {
                return d;
            }
            return e;
        }

        static void Main(string[] args) {
            Console.WriteLine("3rd integer root of 8 = {0}", IRoot(8, 3));
            Console.WriteLine("3rd integer root of 9 = {0}", IRoot(9, 3));

            BigInteger b = BigInteger.Pow(100, 2000) * 2;
            Console.WriteLine("First 2001 digits of the sqaure root of 2: {0}", IRoot(b, 2));
        }
    }
}

Java: import java.math.BigInteger;

public class IntegerRoots {
    private static BigInteger iRoot(BigInteger base, int n) {
        if (base.compareTo(BigInteger.ZERO) < 0 || n <= 0) {
            throw new IllegalArgumentException();
        }

        int n1 = n - 1;
        BigInteger n2 = BigInteger.valueOf(n);
        BigInteger n3 = BigInteger.valueOf(n1);
        BigInteger c = BigInteger.ONE;
        BigInteger d = n3.add(base).divide(n2);
        BigInteger e = n3.multiply(d).add(base.divide(d.pow(n1))).divide(n2);
        while (!c.equals(d) && !c.equals(e)) {
            c = d;
            d = e;
            e = n3.multiply(e).add(base.divide(e.pow(n1))).divide(n2);
        }
        if (d.compareTo(e) < 0) {
            return d;
        }
        return e;
    }

    public static void main(String[] args) {
        BigInteger b = BigInteger.valueOf(8);
        System.out.print("3rd integer root of 8 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(9);
        System.out.print("3rd integer root of 9 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(100).pow(2000).multiply(BigInteger.valueOf(2));
        System.out.print("First 2001 digits of the square root of 2: ");
        System.out.println(iRoot(b, 2));
    }
}
Task: Integer roots
C#: using System;
using System.Numerics;

namespace IntegerRoots {
    class Program {
        static BigInteger IRoot(BigInteger @base, int n) {
            if (@base < 0 || n <= 0) {
                throw new ArgumentException();
            }

            int n1 = n - 1;
            BigInteger n2 = n;
            BigInteger n3 = n1;
            BigInteger c = 1;
            BigInteger d = (n3 + @base) / n2;
            BigInteger e = ((n3 * d) + (@base / BigInteger.Pow(d, n1))) / n2;
            while (c != d && c != e) {
                c = d;
                d = e;
                e = (n3 * e + @base / BigInteger.Pow(e, n1)) / n2;
            }
            if (d < e) {
                return d;
            }
            return e;
        }

        static void Main(string[] args) {
            Console.WriteLine("3rd integer root of 8 = {0}", IRoot(8, 3));
            Console.WriteLine("3rd integer root of 9 = {0}", IRoot(9, 3));

            BigInteger b = BigInteger.Pow(100, 2000) * 2;
            Console.WriteLine("First 2001 digits of the sqaure root of 2: {0}", IRoot(b, 2));
        }
    }
}

Python: def root(a, b):
    if b < 2:
        return b
    a1 = a - 1
    c = 1
    d = (a1 * c + b // (c ** a1)) // a
    e = (a1 * d + b // (d ** a1)) // a
    while c not in (d, e):
        c, d, e = d, e, (a1 * e + b // (e ** a1)) // a
    return min(d, e)


print("First 2,001 digits of the square root of two:\n{}".format(
    root(2, 2 * 100 ** 2000)
))
Task: Integer roots
C#: using System;
using System.Numerics;

namespace IntegerRoots {
    class Program {
        static BigInteger IRoot(BigInteger @base, int n) {
            if (@base < 0 || n <= 0) {
                throw new ArgumentException();
            }

            int n1 = n - 1;
            BigInteger n2 = n;
            BigInteger n3 = n1;
            BigInteger c = 1;
            BigInteger d = (n3 + @base) / n2;
            BigInteger e = ((n3 * d) + (@base / BigInteger.Pow(d, n1))) / n2;
            while (c != d && c != e) {
                c = d;
                d = e;
                e = (n3 * e + @base / BigInteger.Pow(e, n1)) / n2;
            }
            if (d < e) {
                return d;
            }
            return e;
        }

        static void Main(string[] args) {
            Console.WriteLine("3rd integer root of 8 = {0}", IRoot(8, 3));
            Console.WriteLine("3rd integer root of 9 = {0}", IRoot(9, 3));

            BigInteger b = BigInteger.Pow(100, 2000) * 2;
            Console.WriteLine("First 2001 digits of the sqaure root of 2: {0}", IRoot(b, 2));
        }
    }
}

VB: Imports System
Imports System.Numerics
Imports Microsoft.VisualBasic.Strings

Public Module Module1

    Public Function IntSqRoot(v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / 2 - 1)
        IntSqRoot = BigInteger.Parse("3" & StrDup(digs, "0"))
        Dim term As BigInteger
        Do
            term = v / IntSqRoot
            If Math.Abs(CDbl(term - IntSqRoot)) < 2 Then Exit Do
            IntSqRoot = (IntSqRoot + term) / 2
        Loop Until False
    End Function

    Public Function IntNthRoot(n As Integer, v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / n - 1)
        IntNthRoot = BigInteger.Parse(If(digs > 1, 3, 2).ToString() & StrDup(digs, "0"))
        Dim va As BigInteger, dr As BigInteger
        Do
            va = v : For i As Integer = 2 To n : va /= IntNthRoot : Next
            va -= IntNthRoot
            dr = va / n : If dr = 0 Then Exit Do
            IntNthRoot += dr
        Loop Until False
    End Function

    Public Sub Main()
        Dim b As BigInteger = BigInteger.Parse("2" & StrDup(4008, "0"))
        Console.WriteLine("Integer Cube Root of 8:")
        Console.WriteLine(IntNthRoot(3, 8).ToString()) 
        Console.WriteLine("Integer Cube Root of 9:")
        Console.WriteLine(IntNthRoot(3, 9).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, square root method):")
        Console.WriteLine(IntSqRoot(b).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, nth root method):")
        Console.WriteLine(IntNthRoot(2, b).ToString()) 
        Console.WriteLine("Integer Cube Root of 2, (actually 2 * 10 ^ 4008):")
        Console.WriteLine(IntNthRoot(3, b).ToString()) 
        b /= 10000
        Console.WriteLine("Integer 7th Root of 2, (actually 2 * 10 ^ 4004):")
        Console.WriteLine(IntNthRoot(7, b).ToString()) 
        If Diagnostics.Debugger.IsAttached Then Console.Read()
    End Sub

End Module
Task: Integer roots
Go: package main

import "fmt"

func main() {
    fmt.Println(root(3, 8))
    fmt.Println(root(3, 9))
    fmt.Println(root(2, 2e18))
}

func root(N, X int) int {
    
    for r := 1; ; {
        x := X
        for i := 1; i < N; i++ {
            x /= r
        }
        x -= r
        
        
        
        
        Δr := x / N
        if x%N < 0 {
            Δr--
        }
        if Δr == 0 {
            return r
        }
        r += Δr
    }
}

Java: import java.math.BigInteger;

public class IntegerRoots {
    private static BigInteger iRoot(BigInteger base, int n) {
        if (base.compareTo(BigInteger.ZERO) < 0 || n <= 0) {
            throw new IllegalArgumentException();
        }

        int n1 = n - 1;
        BigInteger n2 = BigInteger.valueOf(n);
        BigInteger n3 = BigInteger.valueOf(n1);
        BigInteger c = BigInteger.ONE;
        BigInteger d = n3.add(base).divide(n2);
        BigInteger e = n3.multiply(d).add(base.divide(d.pow(n1))).divide(n2);
        while (!c.equals(d) && !c.equals(e)) {
            c = d;
            d = e;
            e = n3.multiply(e).add(base.divide(e.pow(n1))).divide(n2);
        }
        if (d.compareTo(e) < 0) {
            return d;
        }
        return e;
    }

    public static void main(String[] args) {
        BigInteger b = BigInteger.valueOf(8);
        System.out.print("3rd integer root of 8 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(9);
        System.out.print("3rd integer root of 9 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(100).pow(2000).multiply(BigInteger.valueOf(2));
        System.out.print("First 2001 digits of the square root of 2: ");
        System.out.println(iRoot(b, 2));
    }
}
Task: Integer roots
Java: import java.math.BigInteger;

public class IntegerRoots {
    private static BigInteger iRoot(BigInteger base, int n) {
        if (base.compareTo(BigInteger.ZERO) < 0 || n <= 0) {
            throw new IllegalArgumentException();
        }

        int n1 = n - 1;
        BigInteger n2 = BigInteger.valueOf(n);
        BigInteger n3 = BigInteger.valueOf(n1);
        BigInteger c = BigInteger.ONE;
        BigInteger d = n3.add(base).divide(n2);
        BigInteger e = n3.multiply(d).add(base.divide(d.pow(n1))).divide(n2);
        while (!c.equals(d) && !c.equals(e)) {
            c = d;
            d = e;
            e = n3.multiply(e).add(base.divide(e.pow(n1))).divide(n2);
        }
        if (d.compareTo(e) < 0) {
            return d;
        }
        return e;
    }

    public static void main(String[] args) {
        BigInteger b = BigInteger.valueOf(8);
        System.out.print("3rd integer root of 8 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(9);
        System.out.print("3rd integer root of 9 = ");
        System.out.println(iRoot(b, 3));

        b = BigInteger.valueOf(100).pow(2000).multiply(BigInteger.valueOf(2));
        System.out.print("First 2001 digits of the square root of 2: ");
        System.out.println(iRoot(b, 2));
    }
}

Python: def root(a, b):
    if b < 2:
        return b
    a1 = a - 1
    c = 1
    d = (a1 * c + b // (c ** a1)) // a
    e = (a1 * d + b // (d ** a1)) // a
    while c not in (d, e):
        c, d, e = d, e, (a1 * e + b // (e ** a1)) // a
    return min(d, e)


print("First 2,001 digits of the square root of two:\n{}".format(
    root(2, 2 * 100 ** 2000)
))
Task: Integer roots
Go: package main

import "fmt"

func main() {
    fmt.Println(root(3, 8))
    fmt.Println(root(3, 9))
    fmt.Println(root(2, 2e18))
}

func root(N, X int) int {
    
    for r := 1; ; {
        x := X
        for i := 1; i < N; i++ {
            x /= r
        }
        x -= r
        
        
        
        
        Δr := x / N
        if x%N < 0 {
            Δr--
        }
        if Δr == 0 {
            return r
        }
        r += Δr
    }
}

Python: def root(a, b):
    if b < 2:
        return b
    a1 = a - 1
    c = 1
    d = (a1 * c + b // (c ** a1)) // a
    e = (a1 * d + b // (d ** a1)) // a
    while c not in (d, e):
        c, d, e = d, e, (a1 * e + b // (e ** a1)) // a
    return min(d, e)


print("First 2,001 digits of the square root of two:\n{}".format(
    root(2, 2 * 100 ** 2000)
))
Task: Integer roots
Go: package main

import "fmt"

func main() {
    fmt.Println(root(3, 8))
    fmt.Println(root(3, 9))
    fmt.Println(root(2, 2e18))
}

func root(N, X int) int {
    
    for r := 1; ; {
        x := X
        for i := 1; i < N; i++ {
            x /= r
        }
        x -= r
        
        
        
        
        Δr := x / N
        if x%N < 0 {
            Δr--
        }
        if Δr == 0 {
            return r
        }
        r += Δr
    }
}

VB: Imports System
Imports System.Numerics
Imports Microsoft.VisualBasic.Strings

Public Module Module1

    Public Function IntSqRoot(v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / 2 - 1)
        IntSqRoot = BigInteger.Parse("3" & StrDup(digs, "0"))
        Dim term As BigInteger
        Do
            term = v / IntSqRoot
            If Math.Abs(CDbl(term - IntSqRoot)) < 2 Then Exit Do
            IntSqRoot = (IntSqRoot + term) / 2
        Loop Until False
    End Function

    Public Function IntNthRoot(n As Integer, v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / n - 1)
        IntNthRoot = BigInteger.Parse(If(digs > 1, 3, 2).ToString() & StrDup(digs, "0"))
        Dim va As BigInteger, dr As BigInteger
        Do
            va = v : For i As Integer = 2 To n : va /= IntNthRoot : Next
            va -= IntNthRoot
            dr = va / n : If dr = 0 Then Exit Do
            IntNthRoot += dr
        Loop Until False
    End Function

    Public Sub Main()
        Dim b As BigInteger = BigInteger.Parse("2" & StrDup(4008, "0"))
        Console.WriteLine("Integer Cube Root of 8:")
        Console.WriteLine(IntNthRoot(3, 8).ToString()) 
        Console.WriteLine("Integer Cube Root of 9:")
        Console.WriteLine(IntNthRoot(3, 9).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, square root method):")
        Console.WriteLine(IntSqRoot(b).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, nth root method):")
        Console.WriteLine(IntNthRoot(2, b).ToString()) 
        Console.WriteLine("Integer Cube Root of 2, (actually 2 * 10 ^ 4008):")
        Console.WriteLine(IntNthRoot(3, b).ToString()) 
        b /= 10000
        Console.WriteLine("Integer 7th Root of 2, (actually 2 * 10 ^ 4004):")
        Console.WriteLine(IntNthRoot(7, b).ToString()) 
        If Diagnostics.Debugger.IsAttached Then Console.Read()
    End Sub

End Module
Task: Integer roots
Python: def root(a, b):
    if b < 2:
        return b
    a1 = a - 1
    c = 1
    d = (a1 * c + b // (c ** a1)) // a
    e = (a1 * d + b // (d ** a1)) // a
    while c not in (d, e):
        c, d, e = d, e, (a1 * e + b // (e ** a1)) // a
    return min(d, e)


print("First 2,001 digits of the square root of two:\n{}".format(
    root(2, 2 * 100 ** 2000)
))

VB: Imports System
Imports System.Numerics
Imports Microsoft.VisualBasic.Strings

Public Module Module1

    Public Function IntSqRoot(v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / 2 - 1)
        IntSqRoot = BigInteger.Parse("3" & StrDup(digs, "0"))
        Dim term As BigInteger
        Do
            term = v / IntSqRoot
            If Math.Abs(CDbl(term - IntSqRoot)) < 2 Then Exit Do
            IntSqRoot = (IntSqRoot + term) / 2
        Loop Until False
    End Function

    Public Function IntNthRoot(n As Integer, v As BigInteger) As BigInteger
        Dim digs As Integer = Math.Max(0, v.ToString().Length / n - 1)
        IntNthRoot = BigInteger.Parse(If(digs > 1, 3, 2).ToString() & StrDup(digs, "0"))
        Dim va As BigInteger, dr As BigInteger
        Do
            va = v : For i As Integer = 2 To n : va /= IntNthRoot : Next
            va -= IntNthRoot
            dr = va / n : If dr = 0 Then Exit Do
            IntNthRoot += dr
        Loop Until False
    End Function

    Public Sub Main()
        Dim b As BigInteger = BigInteger.Parse("2" & StrDup(4008, "0"))
        Console.WriteLine("Integer Cube Root of 8:")
        Console.WriteLine(IntNthRoot(3, 8).ToString()) 
        Console.WriteLine("Integer Cube Root of 9:")
        Console.WriteLine(IntNthRoot(3, 9).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, square root method):")
        Console.WriteLine(IntSqRoot(b).ToString()) 
        Console.WriteLine("Integer Square Root of 2, (actually 2 * 10 ^ 4008, nth root method):")
        Console.WriteLine(IntNthRoot(2, b).ToString()) 
        Console.WriteLine("Integer Cube Root of 2, (actually 2 * 10 ^ 4008):")
        Console.WriteLine(IntNthRoot(3, b).ToString()) 
        b /= 10000
        Console.WriteLine("Integer 7th Root of 2, (actually 2 * 10 ^ 4004):")
        Console.WriteLine(IntNthRoot(7, b).ToString()) 
        If Diagnostics.Debugger.IsAttached Then Console.Read()
    End Sub

End Module
Task: Integer roots
C: #include <stdio.h>
#include <math.h>

typedef unsigned long long ulong;

ulong root(ulong base, ulong n) {
    ulong n1, n2, n3, c, d, e;

    if (base < 2) return base;
    if (n == 0) return 1;

    n1 = n - 1;
    n2 = n;
    n3 = n1;
    c = 1;
    d = (n3 + base) / n2;
    e = (n3 * d + base / (ulong)powl(d, n1)) / n2;

    while (c != d && c != e) {
        c = d;
        d = e;
        e = (n3*e + base / (ulong)powl(e, n1)) / n2;
    }

    if (d < e) return d;
    return e;
}

int main() {
    ulong b = (ulong)2e18;

    printf("3rd root of 8 = %lld\n", root(8, 3));
    printf("3rd root of 9 = %lld\n", root(9, 3));
    printf("2nd root of %lld = %lld\n", b, root(b, 2));

    return 0;
}

Python: def root(a, b):
    if b < 2:
        return b
    a1 = a - 1
    c = 1
    d = (a1 * c + b // (c ** a1)) // a
    e = (a1 * d + b // (d ** a1)) // a
    while c not in (d, e):
        c, d, e = d, e, (a1 * e + b // (e ** a1)) // a
    return min(d, e)


print("First 2,001 digits of the square root of two:\n{}".format(
    root(2, 2 * 100 ** 2000)
))