Step 5 of the AKS algorithm on the word RAM #
Step 5 of the AKS algorithm Agrawal, Kayal, Saxena, Section 4 tests the congruence
(X + a)^n ≡ X^n + a (mod X^r - 1, n) for a = 1, …, A. The program runs the test for one a
(Cslib.Algorithms.WordRAM.AKS.Congruence.program) for each a in turn and clears a flag when
one fails.
Main definitions #
Cslib.Algorithms.WordRAM.AKS.CongruenceLoop.program: the loop.Cslib.Algorithms.WordRAM.AKS.CongruenceLoop.time: its instruction bound.
Main results #
Cslib.Algorithms.WordRAM.AKS.CongruenceLoop.exec: the flag is1exactly when the congruence holds for every1 ≤ a ≤ A, withintime r n Ainstructions.
References #
Base address of the result block.
Base address of the base block.
Base address of the scratch block.
The number r of coefficients.
The modulus n.
The tested value a, which is also the loop index.
The answer of one test.
The last tested value A, preserved.
The loop end A + 1.
1 while every test so far has passed.
Constant one.
The test for one a runs on the first 25 registers.
The test for one a.
Test a, record a failure, and advance a.
Test a = 1, …, A.
The instruction bound of program.
Step 5. For r ≥ 1 and n ≥ 1, with the three blocks pairwise disjoint and the word size
holding the block ends, 2 r, n² + n and A + 1, the program leaves 1 in ok exactly when
(X + a)^n ≡ X^n + a (mod X^r - 1, n) for every 1 ≤ a ≤ A, within time r n A instructions.