# Singular

#### D.12.2.14 Atkin

Procedure from library `atkins.lib` (see atkins_lib).

Return:
1, if N is prime,
-1, if N is not prime,
0, if the algorithm is not applicable, since there are too few discriminants

Assume:
N is coprime to 6 and different from 1

Note:
K/2 is input for the procedure "disc",
K is input for the procedure "HilbertClassPoly",
B describes the number of recursions being calculated.
The basis of the algorithm is the following theorem:
Let N be an integer coprime to 6 and different from 1 and E be an ellipic curve modulo N.
Assume that we know an integer m and a point P of E(Z/NZ) satisfying the following conditions.
(1) There exists a prime divisor q of m such that q > (4-th root(N)+1)^2.
(2) m*P = O(E) = (0:1:0).
(3) (m/q)*P = (x:y:t) with t element of (Z/NZ)*.
Then N is prime.

Example:
 ```LIB "atkins.lib"; ring R = 0,x,dp; Atkin(7691,100,5); ==> -1 Atkin(3473,10,2); ==> -1 printlevel=1; Atkin(10000079,100,2); ==> Set i = 0, n = 0 and N(i) = N(0)= 10000079. ==> pause> ==> List H of possibly suitable discriminants will be calculated. ==> H = -3,-4,-7,-8,-11,-12,-15,-16,-19,-20,-23,-24,-27,-28,-31,-32,-35,-36,-\ 39,-40,-43,-44,-47,-48,-51,-52,-55,-56,-59,-60,-63,-64,-67,-68,-71,-72,-7\ 5,-76,-79,-80,-83,-84,-87,-88,-91,-92,-95,-96,-99,-100,-103,-104,-107,-10\ 8,-111,-112,-115,-116,-119,-120,-123,-124,-127,-128,-131,-132,-135,-136,-\ 139,-140,-143,-144,-147,-148,-151,-152,-155,-156,-159,-160,-163,-164,-167\ ,-168,-171,-172,-175,-176,-179,-180,-183,-184,-187,-188,-191,-192,-195,-1\ 96,-199,-200 ==> pause> ==> N(0) = 10000079 is divisible by 5. ==> pause> ==> N(0) = N = 10000079 and therefore N is not prime. ==> pause> ==> -1 ==> > fgets() failed with errno 9 ```