Jump to content
IceyLava108

Double the Last Number

Recommended Posts

Most of the time, Haskell, but pretty much everything will do :cool:

GHCi:
> 2^163
11692013098647223345629478661730264157247460343808

tclsh:
% expr {2**163}
11692013098647223345629478661730264157247460343808

bc:
2^163
11692013098647223345629478661730264157247460343808

C:

#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
 
int main(int argc, char **argv){
  if(argc!=2){
    fprintf(stderr, "%s int\n", argv[0]);
    return EXIT_FAILURE;}
  unsigned long int e = strtoul(argv[1], NULL, 10);

  mpz_t r;
  mpz_init(r);
  mpz_ui_pow_ui(r,2ul,e);
  gmp_printf("%Zd\n",r);
 
  return EXIT_SUCCESS;}

./prog 163
11692013098647223345629478661730264157247460343808

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×