# Big Numbers

This topic is 5395 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello. I have done some work on the Erdos-Strauss Conjecture, and I think I have found a new way how to calculate results. Currently, a method has been developed that has calculated a solution for every number up to 10^14. I would like to match that number with my method. The problem is, I can't seem to find any way how to support numbers that large. Since the method I have involves multiplication, I may need to use numbers as large as 10^20 in my calculations. I also need to use an effecient language for this sort of thing, because as it is it will probably take days to run the program. Can anyone suggest a language to use, and a way to use numbers so large?

##### Share on other sites
I believe LISP supports ints of any size. And if you want to use c or c++ you can use
http://www.swox.com/gmp/

I'm assuming you only need ints (rationals shouldn't be to hard to add).

I've never used gmp, and my LISP is limited. So you may want to look for more experienced suggestions.

##### Share on other sites
Just in case you use Java you can use the BigInteger class. I actually don't know the limits for the numbers used, but i think it'll be ok. Once i experimentated and calcultated the factorial of 1000 (which is pretty big). And it was decently fast too.

##### Share on other sites
Under ANSI C++ you should have a variable keyword called the long long which according to specification should be 64 bits, i.e. ranged from 0 to 18446744073709551615.

##### Share on other sites
Quote:
 Original post by Inmate2993Under ANSI C++ you should have a variable keyword called the long long which according to specification should be 64 bits, i.e. ranged from 0 to 18446744073709551615.

That's not actually enough for 10^20, log-base 10 of 2^64 is only 19, which means you can only get up to 10^19 out of 2^64 bits.

I, personally, despite how much I despise LISP and its derivitives, have had great success using Scheme for large integer calculations. I've also used a BigInteger class in C# that supports memory-sized integers that works pretty nicely and can link in with any .NET language.

##### Share on other sites
Still, 19 is close to 20, and with a little tweeking of the algorithm it might just be enough. It would certainly make the program run faster, especially on 64 bit hardware.

##### Share on other sites
Quote:
 Original post by Wutalife37Hello. I have done some work on the Erdos-Strauss Conjecture, and I think I have found a new way how to calculate results. Currently, a method has been developed that has calculated a solution for every number up to 10^14. I would like to match that number with my method.

Hey, can you please bring this on topic? How is it related to game development?

##### Share on other sites
Quote:
 Hey, can you please bring this on topic? How is it related to game development?

Isn't this the Math and Physics forum?

##### Share on other sites
Sorry, I didn't know it needed to be related to game development for this forum. If necessary, I have no problem with it being moved to the general programming section.

• 21
• 13
• 9
• 17
• 13