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

10000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000 00000

There are 10 kinds of people in the world: those who know binary, and those who don't.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...