A sequence consisting of prime numbers only starts with 2, the first prime. The next term is the smallest unused prime that shares a digit with the previous term. Therefore, the first few terms of the sequence are 2, 23, 3, 13, 11, 17, 7, 37, 31, 19, 29, 59,…
Write a function to compute the first n terms of the sequence.

Solution Stats

4 Solutions

3 Solvers

Last Solution submitted on Jun 14, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers3

Suggested Problems

More from this Author326

Problem Tags

Community Treasure Hunt

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

Start Hunting!