mirror of
https://github.com/lcn2/calc.git
synced 2025-08-19 01:13:27 +03:00
Improve formatting of comments in cal/lucas.cal
This commit is contained in:
@@ -863,10 +863,11 @@ rodseth_xhn(x, h, n)
|
|||||||
* 104 0.0001 %
|
* 104 0.0001 %
|
||||||
* 129 0.0001 %
|
* 129 0.0001 %
|
||||||
*
|
*
|
||||||
* However, a case can be made for considering only odd values for v(1) candidates.
|
* However, a case can be made for considering only odd values for v(1)
|
||||||
* When h * 2^n-1 is prime and h is an odd multiple of 3, a smallest v(1) that
|
* candidates. When h * 2^n-1 is prime and h is an odd multiple of 3,
|
||||||
* is even is extremely rate. Of the list of 146553 known primes of the form
|
* a smallest v(1) that is even is extremely rate. Of the list of 146553
|
||||||
* h*2^n-1 when h is an odd a multiple of 3, none has an smallest v(1) that was even.
|
* known primes of the form h*2^n-1 when h is an odd a multiple of 3,
|
||||||
|
* none has an smallest v(1) that was even.
|
||||||
*
|
*
|
||||||
* See:
|
* See:
|
||||||
*
|
*
|
||||||
@@ -874,9 +875,10 @@ rodseth_xhn(x, h, n)
|
|||||||
*
|
*
|
||||||
* for that list of 146553 known primes of the form h*2^n-1.
|
* for that list of 146553 known primes of the form h*2^n-1.
|
||||||
*
|
*
|
||||||
* That same example for in a sample size of 1000000 numbers of the form h*2^n-1
|
* That same example for in a sample size of 1000000 numbers of the
|
||||||
* where h is an odd multiple of 3, 12996351 <= h <= 13002351,
|
* form h*2^n-1 where h is an odd multiple of 3, 12996351 <= h <= 13002351,
|
||||||
* 4331116 <= n <= 4332116, these are the smallest odd v(1) values that were found:
|
* 4331116 <= n <= 4332116, these are the smallest odd v(1) values that were
|
||||||
|
* found:
|
||||||
*
|
*
|
||||||
* smallest percentage
|
* smallest percentage
|
||||||
* odd v(1) used
|
* odd v(1) used
|
||||||
@@ -916,26 +918,25 @@ rodseth_xhn(x, h, n)
|
|||||||
* 101 0.0002 %
|
* 101 0.0002 %
|
||||||
* 53 0.0001 %
|
* 53 0.0001 %
|
||||||
*
|
*
|
||||||
* Moreover when evaluating odd candidates for v(1), one may cache Jacobi symbol
|
* Moreover when evaluating odd candidates for v(1), one may cache Jacobi
|
||||||
* evaluations to reduce the number of Jacobi symbol evaluations to a minimum.
|
* symbol evaluations to reduce the number of Jacobi symbol evaluations to
|
||||||
* For example, if one tests 5 and finds that the 2nd case fails:
|
* a minimum. For example, if one tests 5 and finds that the 2nd case fails:
|
||||||
*
|
*
|
||||||
* jacobi(5+2, h*2^n-1) != -1
|
* jacobi(5+2, h*2^n-1) != -1
|
||||||
*
|
*
|
||||||
* Then if one is later testing 9, the Jacobi symbol value for the first 1st case:
|
* Then if one is later testing 9, the Jacobi symbol value for the first
|
||||||
|
* 1st case:
|
||||||
*
|
*
|
||||||
* jacobi(7-2, h*2^n-1)
|
* jacobi(7-2, h*2^n-1)
|
||||||
*
|
*
|
||||||
* is already known.
|
* is already known.
|
||||||
*
|
*
|
||||||
* The hit rate in the cache improves (thus fewer Jacobi symbols need evaluating)
|
|
||||||
* if we sort the above "smallest odd v(1) values" in numerical order.
|
|
||||||
* Without Jacobi symbol value caching, it requires on average
|
* Without Jacobi symbol value caching, it requires on average
|
||||||
* 4.851377 Jacobi symbol evaluations. With Jacobi symbol value caching
|
* 4.851377 Jacobi symbol evaluations. With Jacobi symbol value caching
|
||||||
* cacheing, an averare of 4.348820 Jacobi symbol evaluations is needed.
|
* cacheing, an averare of 4.348820 Jacobi symbol evaluations is needed.
|
||||||
*
|
*
|
||||||
* Given this information, when odd h is a multiple of 3 we try, in order,
|
* Given this information, when odd h is a multiple of 3 we try, in order,
|
||||||
* these sorted odd values of X:
|
* these odd values of X:
|
||||||
*
|
*
|
||||||
* 3, 5, 9, 11, 15, 17, 21, 29, 27, 35, 39, 41, 31, 45, 51, 55, 49, 59,
|
* 3, 5, 9, 11, 15, 17, 21, 29, 27, 35, 39, 41, 31, 45, 51, 55, 49, 59,
|
||||||
* 69, 65, 71, 57, 85, 81, 95, 99, 77, 53, 67, 125, 111, 105, 87, 129,
|
* 69, 65, 71, 57, 85, 81, 95, 99, 77, 53, 67, 125, 111, 105, 87, 129,
|
||||||
@@ -946,7 +947,7 @@ rodseth_xhn(x, h, n)
|
|||||||
* jacobi(X-2, h*2^n-1) == 1
|
* jacobi(X-2, h*2^n-1) == 1
|
||||||
* jacobi(X+2, h*2^n-1) == -1
|
* jacobi(X+2, h*2^n-1) == -1
|
||||||
*
|
*
|
||||||
* Less than 1 case out of 1000000 will not be satisifed by the above sorted list.
|
* Less than 1 case out of 1000000 will not be satisifed by the above list.
|
||||||
* If no value in that list works, we start simple search starting with X = 167
|
* If no value in that list works, we start simple search starting with X = 167
|
||||||
* and incrementing by 2 until a value of X is found.
|
* and incrementing by 2 until a value of X is found.
|
||||||
*
|
*
|
||||||
@@ -1141,7 +1142,7 @@ gen_v1(h, n)
|
|||||||
local i; /* x_tbl index */
|
local i; /* x_tbl index */
|
||||||
local v1m2; /* X-2 1st case */
|
local v1m2; /* X-2 1st case */
|
||||||
local v1p2; /* X+2 2nd case */
|
local v1p2; /* X+2 2nd case */
|
||||||
local testval; /* h*2^n-1 - value we are testing if prime */
|
local testval; /* h*2^n-1 - value we are testing if prime */
|
||||||
local mat cached_v1[next_x]; /* cached Jacobi symbol values or 0 */
|
local mat cached_v1[next_x]; /* cached Jacobi symbol values or 0 */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user