Problem 47518. Play Outside In with primes

In the word game Outside In,* you start with a word, take the first and last letters, try to think of a word in which the two letters appear together in the interior, and repeat. For example, starting with ‘MATLAB’, you might proceed as follows:
sombrero, dissolution, kidnap, pickpocket, helicopter, birthright, debtor, tawdry, katydid, backdrop, subpoena, anniversary, payback, napkin, mannequin, solemnity, psychosis, lopsided, balderdash, etc.
You can play alone or with others, and you could add other rules or objectives—e.g., all words must have six or more letters, a person who cannot think of a word is eliminated, players try to generate a list that uses all letters in the alphabet, etc.
This game has one problem: without a convenient and stable word list, it does not translate easily to Cody. So instead of words, let’s use prime numbers. In particular, start with a two-digit seed, find the smallest prime for which the two digits appear together in the interior, create a new two-digit number from the first and last digits of the prime, and repeat.
For example, if the seed is 11, then the list would start 1117, 1171, 2111, 1213, 2131, 1217,… Because the last digits of primes are constrained, you will notice similarities in lists generated from different seeds. Solvers able to plot the numbers might enjoy seeing the patterns for longer lists graphically.
Write a function to play Outside In with primes: given a two-digit seed x, generate a list of n primes following the rules above.
*I devised the game and the name, but I would be surprised if someone had not already thought of it.

Solution Stats

75.0% Correct | 25.0% Incorrect
Last Solution submitted on Sep 12, 2024

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers9

Suggested Problems

More from this Author279

Problem Tags

Community Treasure Hunt

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

Start Hunting!