views:

417

answers:

3

I am Currently trying to write some code in VBA to solve a problem from Project Euler. I have been trying to answer a question that requires you to find primes that can be divided into a number that will not fit in a long. Any suggestions as how to handle this problem?

I know I can split the number between two variables and I have done that for addition and subtraction but never division. Any help will be appreciated.

A: 

You can write a bigint class that takes char* and stores each element in a linked list data item of type int. That way it does not matter how big the integer is. It is not easy though, I am talking about a full blown class.

JonH
A: 

Take a look here: Large Number Arithmetic

Rubens Farias
A: 

i used BigInteger

http://www.codeproject.com/csharp/biginteger.asp

and i using imported a referance from F#

imports Microsoft.FSharp.Math

Microsoft.FSharp.Math.BigInt
Hath
@Hath, OP asks for VBA code; btw, if you got VSTS2010, you can use a native BigInteger implementation in System.Numerics assembly
Rubens Farias
ah, ok. didn't know vs 2010 had a native BigInteger. cheers.
Hath