Problem 50933. Find pairs of primes with the same digit sum
The activities in the paper “A New Function from a Table of Primes” involve listing sets of consecutive primes such that the first and last numbers in the set have the same digit sum. For example, if the set size is 7, the first set that qualifies is 5, 7, 11, 13, 17, 19, 23 because the digit sums of 5 and 23 are both 5.
Write a function that takes two numbers m and n as input and all sets of size m of primes less than n such that the first and last numbers in the set have the same digit sum. Return a two-column matrix with the first prime in the set in the first column and the last prime in the set in the second column. Sort the matrix with the first column in increasing order.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers10
Suggested Problems
-
Numbers with prime factors 2, 3 and 5.
469 Solvers
-
Make a run-length companion vector
638 Solvers
-
Generate N equally spaced intervals between -L and L
859 Solvers
-
Fix the last element of a cell array
1308 Solvers
-
Sum the real and imaginary parts of a complex number
138 Solvers
More from this Author272
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!