From: transkawa on
In article <BtidnU9KIJUT4Y3RnZ2dnUVZ7rqdnZ2d(a)giganews.com>,
krewecherl(a)gmail.com says...
>
> On 10/06/10 06:28, Scott Sauyet wrote:
> > RobG wrote:
> >> Do you know of any ECMAScript libraries (where "library" is just a
> >> collection of functions) that can be used to deal with large integers?
> >> Or where some reasonably easy to understand algorithms have been
> >> published so I might have a go at creating creating some to do simple
> >> arithmetic with very large numbers?
> >
> > I don't know of one. I'd be curious to know if one is out there.
>
> I haven't worked with one, either, but they're out there.
>
> For example, here's a demo I stumbled across a couple of months ago,
> which is actually related to the OP's question - it implements the RSA
> algorithm and has an option to choose between probable primes and true
> primes:
> http://www.leemon.com/crypto/BigInt.html
>
> You can find several other implementations by searching for "javascript
> bigint". Obligatory disclaimer: I haven't looked at the source of any of
> these libraries.
>
> AFAIK, many (most?) modern arbitrary precision libraries for other
> languages are implemented by using base-256 strings as containers. C
> might have a problem with that (when such a string contains a null
> byte), but many other languages, including C++, Java, and JS, can hold
> arbitrary binary data in their string types. In theory, we should be
> able to use base-65536 in JS strings. It shouldn't be too hard to create
> a library for the most common numeric operations, and I'd be surprised
> if there wasn't already something usable out there to build on.
>
> Concerning the primality test required by the OP - I have discovered a
> truly marvelous and efficient way to prove beyond a doubt whether a
> number is prime. Unfortunately, the margin of this posting is too narrow
> to contain it.

was not trying to be mathematically precise. i wanted a take on my
solution to a problem i found in a textbook.

--
Never question, keep asking
234 702 866 8957