Miller-Rabin and Carmichael numbers
In cryptography, large prime numbers are needed, but checking them by factoring is impossible. For this reason, probabilistic primality tests are used.
The simplest test is the Fermat test: if n is prime, for any a, a^(n-1) ≡ 1 (mod n). However, there are composite numbers that fool this test — they are called Carmichael numbers (the smallest is 561). Such a number passes the Fermat test for all coprime bases, but is not prime!
The Miller-Rabin test is stronger. It writes n - 1 = 2^s · d (where d is odd) and checks the sequence a^d, a^(2d), a^(4d), ...: for a prime number, the sequence either starts with 1, or at some step equals n-1. If repeated with several random bases, the probability of error practically drops to zero.
The attached sonlar.txt file contains 20 19-digit numbers. Among them, only one is a true prime number (there are also Carmichael numbers among the rest — do not limit yourself to the Fermat test). Find that prime number and assemble the flag: BAYROQ{M4TH_miller_rabin_<tub son>}