Reputation: 65
Is there any condition for writing a number N as sum of K prime numbers(prime numbers not necessarily distinct)?
Example: If N=6 and K=2 then we can write N as 6=3+3 whereas if N=11 and K=2 then we cannot represent 11 as sum of two primes.
My Approach- I deduced the condition that If K>=N then we cannot represent N as sum of K primes.Also if K=1 then by primality testing we can check whether whether N is a prime number. Also by goldbach's conjecture for even numbers(except 2) N can be represented as sum of two prime numbers.
But the main problem is that I'm not able to predict it for K>=3.
Upvotes: 1
Views: 1609
Reputation: 41
1.Well, first list out all the prime numbers less than and equal to N.
2.Brute Force Approach with backtracking method.
ex :
N = 8
k = 2.
ex : 2
N = 12, k = 4
ex 3:
N = 11, k = 3
Upvotes: 0