Count the primes resulting from changing one digit of a number - MATLAB Cody - MATLAB Central

Problem 60786. Count the primes resulting from changing one digit of a number

Difficulty:Rate
If you start with the number 24 and seek primes by changing a single digit, you can find two: 23 and 29. If you start with 130, you can find three: 131, 137, and 139. If you start with 73, you can find seven: 13, 23, 43, 53, 71, 79, and 83. Notice that even though 73 is prime, it does not register in the count because a digit has not been changed.
Write a function that takes a number as input and determine the number of change-a-digit primes that can be found. Remember that only one digit at a time can be changed. Also, the numbers may not have leading zeros.

Solution Stats

71.43% Correct | 28.57% Incorrect
Last Solution submitted on Jan 31, 2025

Problem Comments

Solution Comments

Show comments

Problem Recent Solvers4

Suggested Problems

More from this Author291

Problem Tags

Community Treasure Hunt

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

Start Hunting!
Go to top of page