Cyclone
Cyclone

Reputation: 18285

Very, very large numbers in vb.net

How is it possible to deal with incredibly long (large) numbers in vb.net?

I am working on Problem 25 in Project Euler, and my program cannot handle these computations.

Is there a data type that can handle thousands of digits?

Upvotes: 4

Views: 7697

Answers (3)

Hans Passant
Hans Passant

Reputation: 941218

The point of the challenge is to make you write the code to handle big numbers. Using a library definitely isn't the point. You know how to solve it with a (large) piece of paper and a pencil, right?

Note how a large number you write on paper can also be a List(Of Digit). All you gotta do is figure out how to add them. And declare victory when the Count property turns into 1000.

Upvotes: 2

Tim Schmelter
Tim Schmelter

Reputation: 460018

One solution is to use the BigInteger function from the Microsoft Visual J# library(when your Framework version is < 4). Just add a reference to vjslib in your project.

Or use String, but that could be slow.

Frome here: Large Number Calculations

Upvotes: 0

Brian
Brian

Reputation: 118865

System.Numerics.BigInteger in .NET 4.0.

Upvotes: 4

Related Questions