All Questions

68
votes
16answers
81629 views

How to implement big int in C++

I'd like to implement a big int class in C++ as a programming exercise—a class that can handle numbers bigger than a long int. I know that there are several open source implementations out ther...
64
votes
12answers
52517 views

Big integers in C#

Currently I am borrowing java.math.BigInteger from the J# libraries as described here. Having never used a library for working with large integers before, this seems slow, on the order of 10 times slo...
14
votes
9answers
40863 views

Handling large numbers in C++?

What is the best way to handle large numeric inputs in C++ (for example 10^100)? For algorithms I usually switch over to ruby and I sometimes use strings. Any other good methods?
77
votes
4answers
126959 views

Handling very large numbers in Python

I've been considering fast poker hand evaluation in Python. It occurred to me that one way to speed the process up would be to represent all the card faces and suits as prime numbers and multiply them...
21
votes
6answers
11513 views

BigInteger equivalent in Swift?

Is there an equivalent to Java's BigInteger class in Swift? I am tying to do large calculations in Swift with positive integers larger than UInt64's maximum number. What is the best way to handle thes...
1
votes
3answers
841 views

Multiplying a huge number times random() (Python)

Problem: Generate large binary strings (length 2000+). Do it quickly, as this generateRandom() function will be called 300,000 times in the algorithm. Attempted Solutions: Generate 3 or 4 binary num...
21
votes
8answers
37097 views

working with incredibly large numbers in .NET

I'm trying to work through the problems on projecteuler.net but I keep running into a couple of problems. The first is a question of storing large quanities of elements in a List<t>. I keep get...
10
votes
5answers
15138 views

Algorithm for dividing very large numbers

I need to write an algorithm(I cannot use any 3rd party library, because this is an assignment) to divide(integer division, floating parts are not important) very large numbers like 100 - 1000 digits...
32
votes
3answers
4148 views

How to sum large numbers?

I am trying to calculate 1 + 1 * 2 + 1 * 2 * 3 + 1 * 2 * 3 * 4 + ... + 1 * 2 * ... * n where n is the user input. It works for values of n up to 12. I want to calculate the sum for n = 13, n = 14 and ...
5
votes
10answers
17295 views

Find factorial of large numbers in Java

I tried to find the factorial of a large number e.g. 8785856 in a typical way using for-loop and double data type. But it is displaying infinity as the result, may be because it is exceeding its limi...

Previous Next