Problem 60952. List even numbers whose Goldbach partition does not use the largest prime
The strong Goldbach conjecture says that every even number greater than 2 can be expressed as a sum of two prime numbers—that is, they all have Goldbach partitions. Several Cody problems involve some form or variation of the Goldbach conjecture. Problems 60 and 56190 ask us to provide Goldbach partitions, and Problem 64 asks us to count Goldbach partitions for an even number. Problem 60739 restricts the Goldbach partitions to twin primes. Problem 44403 involves writing integers greater than 5 as the sum of three primes, and Problem 60949 involves writing integers greater than 2 as a sum of no more than two primes and the number 1.
One approach to finding Goldbach partitions of a target number is to start with the largest prime smaller than that number and determine whether the difference is prime. For example, 10 = 7 + 3, 14 = 11 + 3, and 16 = 13 + 3. However, that approach fails for numbers such as 18, 20, and 23 because in those cases, the difference between the numbers and the largest primes smaller than the numbers is 1, which is not prime.
Write a function that takes an integer and lists even numbers smaller than or equal to that integer whose Goldbach partitions do not use the largest prime. In other words, for each number in the list, the difference between that number and the largest prime smaller than the number must not be prime (i.e., either 1 or composite).
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers5
Suggested Problems
More from this Author309
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!