Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 35s1 days 16 hours 1 minutes 35 seconds.
Price your future right. 60% off with code BLACKSCHOLES at USD checkout. Offer ends in 1d 16h 01m 35s1 days 16 hours 1 minutes 35 seconds.

Sign in to watch this lesson
Advanced - Number Theory · 4:38
Trial division needs about 10^9 steps for one number near 10^18, so big numbers are tested with modular powers instead. The Fermat test proves compositeness when a^(n−1) ≢ 1 but is fooled by Carmichael numbers such as 561 for every coprime base; Miller–Rabin also checks that the squaring walk from a^d reaches −1, leaving at most a quarter of bases as liars, and seven fixed bases make it exact for all 64-bit n.