Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Perl

Idiom #66 Big integer exponentiation

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

use bigint;
my ($x, $y) = (3 ** 200, 25);
my $z = $x ** $y;
using System.Numerics;
var z = BigInteger.Pow(x, n);

New implementation...