This page provides information on the JavaScript Extended Big Number (JSEBN) library. This library is an extension of the original JavaScript Big Number library written by Tom Wu. You can find his original version here. I have extended his library to include the following functions: numDigits(b) - returns the number of digits in base-b; several arithmetic functions to allow easy work with integers: compareToInt, addInt, subtractInt, multiplyInt, divideInt, remainderInt; jacobi - returns the Jacobi symbol of (A,N); squareRoot - returns the integer square root of the big number; isSquare - returns whether the big number is a perfect square.

I have also implemented several probable prime tests and included them in this library. They are: isPrp, isStrongPrp, isEulerPrp, isLucasPrp, isStrongLucasPrp, isSelfridgePrp, isStrongSelfridgePrp, isBPSW, isStrongBPSW. The first 5 Prp tests are all based on the probable prime tests found in Jon Grantham's 2001 paper "Frobenius Pseudoprimes". You can find a copy by Googling:
Grantham, Jon. Frobenius Pseudoprimes. Math. Comp. 70 (2001), 873-891.
The Selfridge Prp tests are Lucas Prp tests using the parameters suggested by John Selfridge.
The BPSW Prp tests are the Baillie-Pomerance-Selfridge-Wagstaff test. The BPSW test is a combination of the Strong Prp test and a Selfridge Prp test. The Strong BPSW test is a combination of the Strong Prp test and the Strong Selfridge Prp test. You can read more about the BPSW test here.

You can download a zip file of the whole JavaScript Extended Big Number (JSEBN) library here (37.1KB).

The following demonstrations will only work if you have JavaScript enabled.

The following demo will show you the results of various probable prime tests. If a particular test returns a 1, then that test is reporting that the input number is probably prime. If a test returns a 0, then the input number is definitely composite. If a test returns a 1 for a number that is composite, then the input number is called a pseudoprime according to that test. Here is a list of a few pseudoprimes that can fool some, but not all, of the tests:
323, 377, 1159, 1829, 3827, 5459, 5777, 9071, 9179, 10877, 561, 1105, 1729, 2047

(Depending on how you access this web page, it may take a long time to run some of these tests. Since these tests are run on your device, your browser may stop responding while processing numbers with many hundreds, or thousands, of digits.)

Test PRP:
PRP Output:

The following demo is an online integer square root calculator. Learn more about integer square roots here.
Test Sqrt:
Sqrt Output: