-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRunInteger.c++
52 lines (38 loc) · 1.12 KB
/
RunInteger.c++
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// -----------------------------------
// projects/c++/integer/RunInteger.c++
// Copyright (C) 2015
// Glenn P. Downing
// -----------------------------------
// --------
// includes
// --------
#include <iostream> // cout, endl
#include <deque> // deque
#include "Integer.h"
// ----
// main
// ----
int main () {
using namespace std;
cout << "RunInteger.c++" << endl << endl;
// less than 300 ms
cout << "*** 20th Mersenne prime: 1,332 digits ***" << endl << endl;
{
const Integer<int> n = Integer<int>(2).pow(4423) - 1;
cout << "2^4423 - 1 = " << n << endl << endl;
}
{
const Integer< int, std::deque<int> > n = Integer< int, std::deque<int> >(2).pow(4423) - 1;
cout << "2^4423 - 1 = " << n << endl << endl;
}
// --------------------------
// extra credit (5 bonus pts)
// --------------------------
// less than 4 min
cout << "*** 30th Mersenne prime: 39,751 digits ***" << endl << endl;
{
const Integer<int> n = Integer<int>(2).pow(132049) - 1;
cout << "2^132049 - 1 = " << n << endl << endl;
}
cout << "Done." << endl;
return 0;}