Maths WorkshopMaths problems with full solutions
Exercise 1143Number theory › PrimesHigh schoolAdded 3 Nov 2026

Primality test up to $\sqrt n$

#primality test#sqrt#trial division

Statement

Test whether 9797 is prime.

Hint

Test divisibility by primes up to 97≈9.8\sqrt{97}\approx9.8.

Show solutionHide solution

Solution

Primes to test. 2,3,5,72,3,5,7.

Divisibility.
- 22: odd.
- 33: digit sum 1616, not divisible by 33.
- 55: ends in 77.
- 77: 97=7⋅13+697=7\cdot13+6, remainder 66.

Conclusion. 9797 is prime.