| | |
Big numbers
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Use the GMP library. It works for me. If you're using Dev-C++, you can just search for packages online with the built in "Check for updates/packages" thing, and find it in the list. If not go here: http://gmplib.org/
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."
--Martin Golding
--Martin Golding
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
How to instal GMP library....dev c++ won'r downlod it, and i don't knoe how to install one i have downloaded from http://gmplib.org/
•
•
Join Date: Aug 2008
Posts: 206
Reputation:
Solved Threads: 31
Talking about using a sledgehammer to crack a nut. No need to use high precision integers at all.
(a^b) mod c can be evaluated using a loop, using modulo arithmetic.
The basic property you need to know is that (x*y) mod z is equal to ((x mod z)*(y mod z)) mod z). From that it is possible to compute (a^b) mod c. I'll leave the precise code as an exercise.
(a^b) mod c can be evaluated using a loop, using modulo arithmetic.
The basic property you need to know is that (x*y) mod z is equal to ((x mod z)*(y mod z)) mod z). From that it is possible to compute (a^b) mod c. I'll leave the precise code as an exercise.
Dev-C++ WILL download it. You have to pick the option in the package downloader that says community devpaks, scroll down and find it. Download it, and it should automatically bring you to an installer.
Last edited by TheBeast32; Sep 12th, 2008 at 2:52 pm.
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live."
--Martin Golding
--Martin Golding
•
•
Join Date: Sep 2008
Posts: 6
Reputation:
Solved Threads: 0
I tried to download it in that way...but i get some error that this file doesn't exist..
i figured out that i must use this kind calculations if i want to work with big nombers:
P = Cd % n
= 62^65 % 133
= 62 * 62^64 % 133
= 62 * (62^2)32 % 133
= 62 * 3844^32 % 133
= 62 * (3844 % 133)^32 % 133
= 62 * 120^32 % 133
.
.
.
= 62 * 36^16 % 133
= 62 * 99^8 % 133
= 62 * 92^4 % 133
= 62 * 85^2 % 133
= 62 * 43 % 133
= 2666 % 133
= 6
How can i write this in c++?
please help
i figured out that i must use this kind calculations if i want to work with big nombers:
P = Cd % n
= 62^65 % 133
= 62 * 62^64 % 133
= 62 * (62^2)32 % 133
= 62 * 3844^32 % 133
= 62 * (3844 % 133)^32 % 133
= 62 * 120^32 % 133
.
.
.
= 62 * 36^16 % 133
= 62 * 99^8 % 133
= 62 * 92^4 % 133
= 62 * 85^2 % 133
= 62 * 43 % 133
= 2666 % 133
= 6
How can i write this in c++?
please help
•
•
Join Date: Aug 2008
Posts: 206
Reputation:
Solved Threads: 31
•
•
•
•
i figured out that i must use this kind calculations if i want to work with big nombers:
P = Cd % n
= 62^65 % 133
= 62 * 62^64 % 133
= 62 * (62^2)32 % 133
= 62 * 3844^32 % 133
= 62 * (3844 % 133)^32 % 133
= 62 * 120^32 % 133
.
.
.
= 62 * 36^16 % 133
= 62 * 99^8 % 133
= 62 * 92^4 % 133
= 62 * 85^2 % 133
= 62 * 43 % 133
= 2666 % 133
= 6
How can i write this in c++?
please help
Last edited by grumpier; Sep 13th, 2008 at 1:13 am.
![]() |
Similar Threads
- factoring function for large numbers (C++)
- Given a big integer,how can i check out whether it's a prime? (C++)
- big integers (C++)
- Store large numbers in C (C++)
- big numbers in C++ 5.4455e07 (C++)
- Help with quicksort (swapping 2 numbers) (C++)
- Sorting Video titles using a ID numbers (Java)
- storing large numbers (C++)
Other Threads in the C++ Forum
- Previous Thread: stuck with abstract class, function overriding
- Next Thread: Need help displaying my array
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






