Quote:
Originally Posted by mayjune
nicee...
Quote:
Originally Posted by nimesh
That's nice.
Thanks.
Quote:
Originally Posted by Seema786
yeah, dat's nice. very good.
Thanx everyone !!

But, my code had a little bug which gave a few (15%) invalid outputs like :
Quote:
--> { 2, 5, 17, 29, 47 }
--> { 2, 5, 19, 31, 43 }
--> { 2, 5, 19, 37, 37 } -- There should no repetitions.
--> { 2, 5, 23, 29, 41 }
--> { 2, 7, 11, 13, 67 }
--> { 2, 7, 11, 19, 61 }
The bug is fixed now. (2day morning)
And, I will soon post this as an article as shabbir said.

And BTW, the correct list is here : (198 different unique sets, not 233)

Code: Output
(~) Found 6 ways of expressing 100 as a sum of 2 primes.
-->  { 3, 97 }
-->  { 11, 89 }
-->  { 17, 83 }
-->  { 29, 71 }
-->  { 41, 59 }
-->  { 47, 53 }
(~) Found 3 ways of expressing 100 as a sum of 3 primes.
-->  { 2, 19, 79 }
-->  { 2, 31, 67 }
-->  { 2, 37, 61 }
(~) Found 64 ways of expressing 100 as a sum of 4 primes.
-->  { 3, 5, 13, 79 }
-->  { 3, 5, 19, 73 }
-->  { 3, 5, 31, 61 }
-->  { 3, 7, 11, 79 }
-->  { 3, 7, 17, 73 }
-->  { 3, 7, 19, 71 }
-->  { 3, 7, 23, 67 }
-->  { 3, 7, 29, 61 }
-->  { 3, 7, 31, 59 }
-->  { 3, 7, 37, 53 }
-->  { 3, 7, 43, 47 }
-->  { 3, 11, 13, 73 }
-->  { 3, 11, 19, 67 }
-->  { 3, 13, 17, 67 }
-->  { 3, 13, 23, 61 }
-->  { 3, 13, 31, 53 }
-->  { 3, 13, 37, 47 }
-->  { 3, 13, 41, 43 }
-->  { 3, 17, 19, 61 }
-->  { 3, 17, 37, 43 }
-->  { 3, 19, 31, 47 }
-->  { 3, 19, 37, 41 }
-->  { 3, 23, 31, 43 }
-->  { 3, 29, 31, 37 }
-->  { 5, 7, 17, 71 }
-->  { 5, 7, 29, 59 }
-->  { 5, 7, 41, 47 }
-->  { 5, 11, 13, 71 }
-->  { 5, 11, 17, 67 }
-->  { 5, 11, 23, 61 }
-->  { 5, 11, 31, 53 }
-->  { 5, 11, 37, 47 }
-->  { 5, 11, 41, 43 }
-->  { 5, 13, 23, 59 }
-->  { 5, 13, 29, 53 }
-->  { 5, 17, 19, 59 }
-->  { 5, 17, 31, 47 }
-->  { 5, 17, 37, 41 }
-->  { 5, 19, 23, 53 }
-->  { 5, 19, 29, 47 }
-->  { 5, 23, 29, 43 }
-->  { 5, 23, 31, 41 }
-->  { 7, 11, 23, 59 }
-->  { 7, 11, 29, 53 }
-->  { 7, 13, 19, 61 }
-->  { 7, 13, 37, 43 }
-->  { 7, 17, 23, 53 }
-->  { 7, 17, 29, 47 }
-->  { 7, 19, 31, 43 }
-->  { 7, 23, 29, 41 }
-->  { 11, 13, 17, 59 }
-->  { 11, 13, 23, 53 }
-->  { 11, 13, 29, 47 }
-->  { 11, 17, 19, 53 }
-->  { 11, 17, 29, 43 }
-->  { 11, 17, 31, 41 }
-->  { 11, 19, 23, 47 }
-->  { 11, 19, 29, 41 }
-->  { 11, 23, 29, 37 }
-->  { 13, 17, 23, 47 }
-->  { 13, 17, 29, 41 }
-->  { 13, 19, 31, 37 }
-->  { 17, 19, 23, 41 }
-->  { 17, 23, 29, 31 }
(~) Found 55 ways of expressing 100 as a sum of 5 primes.
-->  { 2, 3, 5, 7, 83 }
-->  { 2, 3, 5, 11, 79 }
-->  { 2, 3, 5, 17, 73 }
-->  { 2, 3, 5, 19, 71 }
-->  { 2, 3, 5, 23, 67 }
-->  { 2, 3, 5, 29, 61 }
-->  { 2, 3, 5, 31, 59 }
-->  { 2, 3, 5, 37, 53 }
-->  { 2, 3, 5, 43, 47 }
-->  { 2, 3, 7, 17, 71 }
-->  { 2, 3, 7, 29, 59 }
-->  { 2, 3, 7, 41, 47 }
-->  { 2, 3, 11, 13, 71 }
-->  { 2, 3, 11, 17, 67 }
-->  { 2, 3, 11, 23, 61 }
-->  { 2, 3, 11, 31, 53 }
-->  { 2, 3, 11, 37, 47 }
-->  { 2, 3, 11, 41, 43 }
-->  { 2, 3, 13, 23, 59 }
-->  { 2, 3, 13, 29, 53 }
-->  { 2, 3, 17, 19, 59 }
-->  { 2, 3, 17, 31, 47 }
-->  { 2, 3, 17, 37, 41 }
-->  { 2, 3, 19, 23, 53 }
-->  { 2, 3, 19, 29, 47 }
-->  { 2, 3, 23, 29, 43 }
-->  { 2, 3, 23, 31, 41 }
-->  { 2, 5, 7, 13, 73 }
-->  { 2, 5, 7, 19, 67 }
-->  { 2, 5, 11, 23, 59 }
-->  { 2, 5, 11, 29, 53 }
-->  { 2, 5, 13, 19, 61 }
-->  { 2, 5, 13, 37, 43 }
-->  { 2, 5, 17, 23, 53 }
-->  { 2, 5, 17, 29, 47 }
-->  { 2, 5, 19, 31, 43 }
-->  { 2, 5, 23, 29, 41 }
-->  { 2, 7, 11, 13, 67 }
-->  { 2, 7, 11, 19, 61 }
-->  { 2, 7, 11, 37, 43 }
-->  { 2, 7, 13, 17, 61 }
-->  { 2, 7, 13, 19, 59 }
-->  { 2, 7, 13, 31, 47 }
-->  { 2, 7, 13, 37, 41 }
-->  { 2, 7, 17, 31, 43 }
-->  { 2, 7, 19, 29, 43 }
-->  { 2, 7, 19, 31, 41 }
-->  { 2, 7, 23, 31, 37 }
-->  { 2, 11, 13, 31, 43 }
-->  { 2, 11, 17, 23, 47 }
-->  { 2, 11, 17, 29, 41 }
-->  { 2, 11, 19, 31, 37 }
-->  { 2, 13, 17, 31, 37 }
-->  { 2, 13, 19, 23, 43 }
-->  { 2, 13, 19, 29, 37 }
(~) Found 34 ways of expressing 100 as a sum of 6 primes.
-->  { 3, 5, 7, 11, 13, 61 }
-->  { 3, 5, 7, 11, 31, 43 }
-->  { 3, 5, 7, 13, 19, 53 }
-->  { 3, 5, 7, 13, 29, 43 }
-->  { 3, 5, 7, 13, 31, 41 }
-->  { 3, 5, 7, 17, 31, 37 }
-->  { 3, 5, 7, 19, 23, 43 }
-->  { 3, 5, 7, 19, 29, 37 }
-->  { 3, 5, 11, 13, 31, 37 }
-->  { 3, 5, 11, 17, 23, 41 }
-->  { 3, 5, 13, 17, 19, 43 }
-->  { 3, 5, 13, 19, 23, 37 }
-->  { 3, 5, 13, 19, 29, 31 }
-->  { 3, 7, 11, 13, 19, 47 }
-->  { 3, 7, 11, 13, 23, 43 }
-->  { 3, 7, 11, 13, 29, 37 }
-->  { 3, 7, 11, 17, 19, 43 }
-->  { 3, 7, 11, 19, 23, 37 }
-->  { 3, 7, 11, 19, 29, 31 }
-->  { 3, 7, 13, 17, 19, 41 }
-->  { 3, 7, 13, 17, 23, 37 }
-->  { 3, 7, 13, 17, 29, 31 }
-->  { 3, 7, 17, 19, 23, 31 }
-->  { 3, 11, 13, 17, 19, 37 }
-->  { 3, 11, 13, 19, 23, 31 }
-->  { 5, 7, 11, 13, 17, 47 }
-->  { 5, 7, 11, 13, 23, 41 }
-->  { 5, 7, 11, 17, 19, 41 }
-->  { 5, 7, 11, 17, 23, 37 }
-->  { 5, 7, 11, 17, 29, 31 }
-->  { 5, 7, 17, 19, 23, 29 }
-->  { 5, 11, 13, 17, 23, 31 }
-->  { 5, 11, 13, 19, 23, 29 }
-->  { 7, 11, 13, 17, 23, 29 }
(~) Found 35 ways of expressing 100 as a sum of 7 primes.
-->  { 2, 3, 5, 7, 11, 13, 59 }
-->  { 2, 3, 5, 7, 11, 19, 53 }
-->  { 2, 3, 5, 7, 11, 29, 43 }
-->  { 2, 3, 5, 7, 11, 31, 41 }
-->  { 2, 3, 5, 7, 13, 17, 53 }
-->  { 2, 3, 5, 7, 13, 23, 47 }
-->  { 2, 3, 5, 7, 13, 29, 41 }
-->  { 2, 3, 5, 7, 17, 19, 47 }
-->  { 2, 3, 5, 7, 17, 23, 43 }
-->  { 2, 3, 5, 7, 17, 29, 37 }
-->  { 2, 3, 5, 7, 19, 23, 41 }
-->  { 2, 3, 5, 7, 23, 29, 31 }
-->  { 2, 3, 5, 11, 13, 19, 47 }
-->  { 2, 3, 5, 11, 13, 23, 43 }
-->  { 2, 3, 5, 11, 13, 29, 37 }
-->  { 2, 3, 5, 11, 17, 19, 43 }
-->  { 2, 3, 5, 11, 19, 23, 37 }
-->  { 2, 3, 5, 11, 19, 29, 31 }
-->  { 2, 3, 5, 13, 17, 19, 41 }
-->  { 2, 3, 5, 13, 17, 23, 37 }
-->  { 2, 3, 5, 13, 17, 29, 31 }
-->  { 2, 3, 5, 17, 19, 23, 31 }
-->  { 2, 3, 7, 11, 13, 17, 47 }
-->  { 2, 3, 7, 11, 13, 23, 41 }
-->  { 2, 3, 7, 11, 17, 19, 41 }
-->  { 2, 3, 7, 11, 17, 23, 37 }
-->  { 2, 3, 7, 11, 17, 29, 31 }
-->  { 2, 3, 7, 17, 19, 23, 29 }
-->  { 2, 3, 11, 13, 17, 23, 31 }
-->  { 2, 3, 11, 13, 19, 23, 29 }
-->  { 2, 5, 7, 11, 13, 19, 43 }
-->  { 2, 5, 7, 13, 17, 19, 37 }
-->  { 2, 5, 7, 13, 19, 23, 31 }
-->  { 2, 5, 11, 13, 17, 23, 29 }
-->  { 2, 7, 11, 13, 17, 19, 31 }
(~) Found 1 ways of expressing 100 as a sum of 9 primes.
-->  { 2, 3, 5, 7, 11, 13, 17, 19, 23 }

@shabbir:

Can we have a separate section for submitting source-codes instead of posting them in the articles section ?
Of course there is no problem with posting them as article, 'coz some explanation is included with the source code; but I think the tutorial articles and source codes get mixed this way.