js test 013

This example uses string math to perform long division of any size integers. The calculation is performed by a C program on the server, called from PHP, for the best speed. The division (and other arithmetic operations) code was developed in js, and then translated to C. To find a repeating sequence of length n, at least 2 * n digits are needed. The maximum length of a sequence for i/j for a given j and all i appears to be bounded by j - 1. In these cases, j is definitely prime as well.

©Copyright Sky Coyote, 2013.