Logo

Programming-Idioms

Calculate the result z of x power n, where x is a big integer and n is a positive integer.
New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
using System.Numerics;
var z = BigInteger.Pow(x, n);
import std.bigint;
BigInt z = x ^^ n;
import "dart:math";
var z = pow(x, n);
z = :math.pow(x, n)
import "math/big"
nb := big.NewInt(int64(n))
var z big.Int
z.Exp(x, nb, nil)
z = x ^ n
let z = x**n
import java.math.BigInteger;
BigInteger z = x.pow(n);
use bigint;
my ($x, $y) = (3 ** 200, 25);
my $z = $x ** $y;
z = x**n
z = x ** n
extern crate num;
let z = num::pow(x, n);
z := x raisedTo: n.
z := x ** n.