我如何检查大数字素数。 [英] How I Can Check Large Digit Prime Number.

查看:71
本文介绍了我如何检查大数字素数。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用c ++检查大数是否为素数

我想检查

48112959837082048697

数是否是素数。

这是20位素数,但我的c ++程序无法检查它。

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.

推荐答案

你可以使用C++ Big Integer Library [ ^ ] Matt McCutchen:



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

#include "BigIntegerLibrary.hh"

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

(prints 340282366920938463463374607431768211456)


这篇关于我如何检查大数字素数。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆