To do problem 16, I had to learn python!
I am a still a novice and I program using C. But, with all the speed comes a bit of a limitation with C as well. The longest integer is unsigned long long int type and as I have learned, that is usually not good enough for project euler problems.
I know that you can use arrays to get around that problem. But, I also read on a blog about bignum libraries that can solve this problem. So, I went ahead and downloaded a couple: GMP, miracl and ttcalc...that was it. I have no idea how to actually use these.
The IDE I use is Dev-c++ on windows 7 64 bit version.
I could just continue using python...but it's slow. For instance, I just did problem 14...first with python, then, with the exact same algorithm in C. The python code ran for about 20 times as much as the C program did. Also, I'm more comfortable with C.
So, if someone could just explain how to use these bignum libs, that's be really great.
How do I use bignum libraries
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: How do I use bignum libraries
It seems that you have been crossposting in several threads.
I answered you in the other thread.
I answered you in the other thread.

War ruins the life and health of untold numbers of innocent children.
-
prasoon2211
- Posts: 3
- Joined: Wed Jul 06, 2011 12:30 pm
Re: How do I use bignum libraries
First of all, you have NOT answered my question (even in the other thread). You have merely commented on it.
Second of all, I did not cross-post in 'several' threads. Only two. Look up for what several means. Also, I did that because this was the first time I happened to use the PE forums and I didn't know that people can give 'answers' that quick.
Second of all, I did not cross-post in 'several' threads. Only two. Look up for what several means. Also, I did that because this was the first time I happened to use the PE forums and I didn't know that people can give 'answers' that quick.
- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: How do I use bignum libraries
Oh, I'm awfullyy sorry. I will never do that again. How stupid of me.
Nevertheless, you were crossposting weren't you?
When entering somewhere new, it might be wise to refrain from that, to see what happens first.
Nevertheless, you were crossposting weren't you?
When entering somewhere new, it might be wise to refrain from that, to see what happens first.

War ruins the life and health of untold numbers of innocent children.
- Lord_Farin
- Posts: 239
- Joined: Wed Jul 01, 2009 10:43 am
- Location: Netherlands
Re: How do I use bignum libraries
It is not really stupid. It is comparable to someone asking how to make $5000 in 4 days because he has to make a tax payment by then, and you tell him how to request extension of the payment deadline. There's nothing wrong with solving (or, trying to solve) the problem by solving something further up the chain, at least not in my opinion.hk wrote:Oh, I'm awfullyy sorry. I will never do that again. How stupid of me.

-
Hibernatus34
- Posts: 31
- Joined: Mon May 16, 2011 7:03 am
Re: How do I use bignum libraries
Unless you're a C fanatic, i recommend using C++ for readability (objects and operator overloading make it look like true scalar types).prasoon2211 wrote:First of all, you have NOT answered my question (even in the other thread). You have merely commented on it.
Second of all, I did not cross-post in 'several' threads. Only two. Look up for what several means. Also, I did that because this was the first time I happened to use the PE forums and I didn't know that people can give 'answers' that quick.
As an example, here is an easy to use C++ class (but slow and not as powerful as GMP) : http://sourceforge.net/projects/cpp-bigint/
I also recommend solving these problems the way they were intended to, because it takes less time than learning how to install and use GMP, and it's more fun.
Now, if what you really want is installing and using these libs, maybe you could ask that on a forum that is dedicated to C programming !
Joined PE in May 2011- hk
- Administrator
- Posts: 12832
- Joined: Sun Mar 26, 2006 10:34 am
- Location: Haren, Netherlands
Re: How do I use bignum libraries
I'm allways happy to apologize. Particularly to people that are a little bit touchy.Lord_Farin wrote:It is not really stupid. It is comparable to someone asking how to make $5000 in 4 days because he has to make a tax payment by then, and you tell him how to request extension of the payment deadline. There's nothing wrong with solving (or, trying to solve) the problem by solving something further up the chain, at least not in my opinion.hk wrote:Oh, I'm awfullyy sorry. I will never do that again. How stupid of me.

War ruins the life and health of untold numbers of innocent children.