Click here to Skip to main content
15,891,204 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
How i can check that large number is prime or not using c++
I want to check
48112959837082048697
number is prime or not.
this is 20 digit prime number but my program in c++ can not check it.
Posted

1 solution

You can use the C++ Big Integer Library[^] of Matt McCutchen:

C++
#include "BigIntegerLibrary.hh"

BigInteger a = 65536;
cout << (a * a * a * a * a * a * a * a);

(prints 340282366920938463463374607431768211456)
 
Share this answer
 
Comments
/\jmot 29-Jan-15 7:09am    
good move. +5
:)
Leo Chapiro 29-Jan-15 7:36am    
Thank you!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900