Largest Twin Primes - MATLAB Cody - MATLAB Central

Problem 1096. Largest Twin Primes

Difficulty:Rate

Twin primes are primes p1, p2 = p1 + 2 such that both p1 and p2 are prime numbers. Given a positive integer N (>=5) what are the largest twin primes (in order) <= N. For example, if N = 20 then p1 = 17 and p2 = 19.

Solution Stats

46.11% Correct | 53.89% Incorrect
Last Solution submitted on Jun 14, 2025

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers835

Suggested Problems

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!