We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Project Euler #249: Prime Subset Sums
Project Euler #249: Prime Subset Sums
Sort by
recency
|
32 Discussions
|
Please Login in order to post a comment
I just wanna know any solution which doesn't need pre-calculated constants. I pre-calculated an array with length=7000, and compressed the continuous repeat values so that my submitted code won't exceed 50kB.
https://github.com/Sundesh7/Hackerrank-Solutions/blob/main/Project%20Euler%20%23249:%20Prime%20Subset%20Sumshttps://github.com/Sundesh7/Hackerrank-Solutions/blob/main/Project%20Euler%20%23249:%20Prime%20Subset%20Sums Two cases success!
There is no point of this problem.
In input 0
2 10 4
what is the role of 2 ?
2 is the size of the upcoming array. 10,4 are the elements of the array.
for each element
i
in the array, do the following: 1. find the set of prime numbers from 0-i. 2. Find all the subsets from the above set, such that, the sum of those subset is again a prime number. 3. Do step 1&2 for all the numbers in the array.which are less than 4? [2 3 5 5 7 7 17] -> [{2},{3},{5},{2;3},{7},{2;5},{2;3;5;7}]
2 and 3 right? Why does the exercise say 3?
{2}
=2,{3}
=2,{2,3}
=5