# Question:Maple special_primes

## Question:Maple special_primes

Maple 18

I am trying to understand how maple "isprime" algorithm works. But I can't find anywhere what special_primes means.

showstat(isprime);

isprime := proc(n)
local btor, nr, p, r;
1   if not type(n,'integer') then
2     if type(n,('complex')('numeric')) then
3       error "argument must be an integer"
else
4       return 'isprime(n)'
end if
end if;
5   if n < 2 then
6     return false
elif member(n,isprime:-special_primes) then
7     return true
elif igcd(2305567963945518424753102147331756070,n) <> 1 then
8     return false
elif n < 10201 then
9     return true
elif igcd(8496969489233418110532339909187349965926062586648932736611545426342203893270769390909069477309509137509786917118668028861499333825097682386722983737962963066757674131126736578936440788157186969893730633113066478620448624949257324022627395437363639038752608166758661255956834630697220447512298848222228550062683786342519960225996301315945644470064720696621750477244528915927867113,n) <> 1 then
10     return false
elif n < 1018081 then
11     return true
else
12     r := gmp_isprime(n);
13     if not r or n <= 5000000000 then
14       return r
end if;
15     nr := igcd(408410100000,n-1);
16     nr := igcd(nr^5,n-1);
17     r := iquo(n-1,nr);
18     btor := modp(('power')(2,r),n);
19     if cyclotest(n,btor,2,r) = false or irem(nr,3) = 0 and cyclotest(n,btor,3,r) = false or irem(nr,5) = 0 and cyclotest(n,btor,5,r) = false or irem(nr,7) = 0 and cyclotest(n,btor,7,r) = false then
20       return false
end if;
21     if isqrt(n)^2 = n then
22       return false
end if;
23     for p from 3 while numtheory:-jacobi(p^2-4,n) <> -1 do
24       NULL
end do;
25     return evalb(TraceModQF(p,n+1,n) = [2, p])
end if
end proc

﻿