Problem 64. The Goldbach Conjecture, Part 2
The Goldbach conjecture asserts that every even integer greater than 2 can be expressed as the sum of two primes.
Given the even integer n, return c, the number of different ways two primes can be added to result in n. Only count a pair once; the order is unimportant.
Example:
Input n = 10 Output c is 2
because of the prime pairs [3 7] and [5 5].
Input n = 50 Output c is 4
because of [3 47], [7 43], [13 37], and [19 31].
Solution Stats
Problem Comments
-
3 Comments
Dima Panna
on 1 Jun 2019
For some reason the 'nthprime' function is not recognized, however it works for me in my desktop MATLAB.
Asif Newaz
on 1 Nov 2019
@Dima Panna 'nthprime' uses symbolic math toolbox which is not supported in cody
Faisal deshpande
on 28 Aug 2021
I have used same solution approach as in goldbach conjecture part 1.
Solution Comments
Show commentsGroup

Computational Geometry II
- 20 Problems
- 18 Finishers
- Dots in a Diamond
- Property dispute!
- Shifted Hexagonal Tiling Dots in a Circle
- Hexagonal Tiling Dots in a Circle
- Dots in a Sphere
- Triangular Tiling Dots in a Circle
- Beads on a Necklace (Convex Hulls)
- Minimum Distance between two N-sided Polygons
- Minimum Distance Point to Segment
- Dots in a Circle
- Edges of a n-dimensional Hypercube
- Volume of a Simplex
- Find the optimal shape to bring the maximum product by a given perimeter
- Number of lattice points within a circle
- Points on a circle.
- Perimeter
- Geometry: Find Circle given 3 Non-Colinear Points
- Points on a Sphere
- Volume difference between Ellipsoid and Sphere
- Property dispute!
- Crossing to Kissing - Untangle the Lines
Problem Recent Solvers2367
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!