Uploaded July 2025 | Updated November 2026, 3 days ago
The United States of America prime is a 5,382 digit prime number found by Vadim Ponomarenko and tested using the Baillie–PSW primality test. The number passed the test, making it highly likely to be a prime number that looks like the American flag, but later Robert Baillie himself verified the number is prime using Pari/GP. Today we discuss the Baillie-PSW primality test you could use yourself to find a prime number that looks like your country's flag, and discuss several necessary concepts involved including Fermat primes, Fermat's Little theorem, the strong probably prime test, the Jacobi Symbol, the Legendre Symbol, and Lucas sequences. Happy Independence Day. #maths #mathematics
Check out the coolest math clothes in the world: mathshion.com
Join Wrath of Math to get exclusive videos, lecture notes, and more:
youtube.com/channel/UCyEKvaxi8mt9FMc62MHcliw/join
More Math Chats: youtube.com/playlist?list=PLztBpqftvzxXQDmPmSOwXSU9vOHgty1RO
Outro music: youtube.com/shorts/tfifiSdTZRg
Follow Wrath of Math on...
● Instagram: instagram.com/wrathofmathedu
● TikTok: tiktok.com/@wrathofmathedu
● X: https://x.com/wrathofmathedu
SOURCES
Ponomarenko, Vadim. “The United States of America Prime.” Math Horizons, vol. 28, no. 4, 2021, p. 19. JSTOR, jstor.org/stable/48665195.
Prime Numbers: A Computational Perspective by Carl Pomerance and Richard Crandall
Pomerance, Carl, et al. “The Pseudoprimes to $25 \cdot 10^9$.” Mathematics of Computation, vol. 35, no. 151, 1980, pp. 1003–26. JSTOR, doi.org/10.2307/2006210.
https://math.umd.edu/~immortal/MATH406/lecturenotes/ch11-3.pdf
SOME COMMENTS ON BAILLIE-PSW PSEUDOPRIMES by Chen and Greene
cs.stackexchange.com/questions/69386/more-details-about-the-baillie-psw-test/77811#77811
en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_test#The_test
mathworks.com/help/symbolic/jacobisymbol.html
github.com/sagemath/sage/blob/develop/src/sage/arith/misc.py#L575
mathworld.wolfram.com/Baillie-PSWPrimalityTest.html
0:00 Intro
1:43 Checking Primes
3:10 The USA Prime
4:34 Fermat's Little Theorem
9:01 Base 2 Strong Probable Prime Test
14:17 Step 2
16:46 Legendre Symbol
18:35 Jacobi Symbol
20:14 D, P, Q
22:15 Lucas Sequence
25:33 119 is Pseudoprime
26:44 A Really Good Test
27:55 Method
28:34 Conclusion
The United States of America prime is a 5,382 digit prime number found by Vadim Ponomarenko and tested using the Baillie–PSW primality test. The number passed the test, making it highly likely to be a prime number that looks like the American flag, but later Robert Baillie himself verified the number is prime using Pari/GP. Today we discuss the Baillie-PSW primality test you could use yourself to find a prime number that looks like your country's flag, and discuss several necessary concepts involved including Fermat primes, Fermat's Little theorem, the strong probably prime test, the Jacobi Symbol, the Legendre Symbol, and Lucas sequences. Happy Independence Day. #maths #mathematics
Check out the coolest math clothes in the world: mathshion.com
Join Wrath of Math to get exclusive videos, lecture notes, and more:
youtube.com/channel/UCyEKvaxi8mt9FMc62MHcliw/join
More Math Chats: youtube.com/playlist?list=PLztBpqftvzxXQDmPmSOwXSU9vOHgty1RO
Outro music: youtube.com/shorts/tfifiSdTZRg
Follow Wrath of Math on...
● Instagram: instagram.com/wrathofmathedu
● TikTok: tiktok.com/@wrathofmathedu
● X: https://x.com/wrathofmathedu
SOURCES
Ponomarenko, Vadim. “The United States of America Prime.” Math Horizons, vol. 28, no. 4, 2021, p. 19. JSTOR, jstor.org/stable/48665195.
Prime Numbers: A Computational Perspective by Carl Pomerance and Richard Crandall
Pomerance, Carl, et al. “The Pseudoprimes to $25 \cdot 10^9$.” Mathematics of Computation, vol. 35, no. 151, 1980, pp. 1003–26. JSTOR, doi.org/10.2307/2006210.
https://math.umd.edu/~immortal/MATH406/lecturenotes/ch11-3.pdf
SOME COMMENTS ON BAILLIE-PSW PSEUDOPRIMES by Chen and Greene
cs.stackexchange.com/questions/69386/more-details-about-the-baillie-psw-test/77811#77811
en.wikipedia.org/wiki/Baillie%E2%80%93PSW_primality_test#The_test
mathworks.com/help/symbolic/jacobisymbol.html
github.com/sagemath/sage/blob/develop/src/sage/arith/misc.py#L575
mathworld.wolfram.com/Baillie-PSWPrimalityTest.html
0:00 Intro
1:43 Checking Primes
3:10 The USA Prime
4:34 Fermat's Little Theorem
9:01 Base 2 Strong Probable Prime Test
14:17 Step 2
16:46 Legendre Symbol
18:35 Jacobi Symbol
20:14 D, P, Q
22:15 Lucas Sequence
25:33 119 is Pseudoprime
26:44 A Really Good Test
27:55 Method
28:34 Conclusion










