Some books with information on primality testing (easiest to read first):
Introduction to Algorithms, 2nd edition, by Cormen, Leiserson, Rivest, and Stein.
Cryptography: Theory and Practice, 2nd edition, by Stinson.
Algorithmic Number Theory, Volume 1, by Bach and Shallit.
Prime Numbers and Computer Methods for Factorization, by Riesel.
Notes
An older Discrete Math course had
notes
(pages 3 to 12 are the most relevant - Extended Euclidean
Algorithm and algebra)
and slides
on elementary number theory, probability, equivalence relations
and algebra (pages 32-47, 58-64, 78-86, 97-102, 145-147, 158-159,
182-194 are most relevant - the last group is the slides on algebra).
Miscellaneous
Andrew Swann's links and metalinks to relevant to students writing mathematical projects.