2
0
The challenge is to create an iterator(/generator) which iterates (in any order so as to reach all of them... ie no set should occur at infinity) over all possible non-empty finite sets(/tuples/lists) of positive integers (hence demonstrating their countability).
Since the problem of verifying the correctness of a solution is undecidable in some cases, an accompanying explanation of how your program works and what order the sets are returned in would be helpful
Each finite set should occur exactly once. So if left running long enough, the iterator should eventually hit each of {1}, {3,5}, {17,29,306} etc. exactly once
I realize now that simply counting upwards from 1 and listing the set bits in each number gives exactly this. I had an altogether more complex and pointless solution in mind. Perhaps I should post another problem for all non-empty finite "lists" of positive integers (ie ordered and with repeats) or perhaps sets with multiplicities (unordered, but with repeats) – dspyz – 2012-06-17T08:06:09.850
Problem fixed with extra credit; For lists, you can simply add a 0 onto all the sets in the original problem and then take the differences between successive terms.
For multiplicities, just filter the lists for ones which are non-descending – dspyz – 2012-06-17T10:01:03.527
2
Please do not change the challange after it was posted. Instead you should post it here and discuss it before it becomes an open puzzle.
– Howard – 2012-06-17T10:19:04.237Thank you. If you don't mind, I will delete this question, post it there and get help with it and then repost it when I'm ready. – dspyz – 2012-06-18T04:06:38.783
I'd leave it as it is. It is a valid challenge and maybe others are already working on a solution. You may of course create a new question with different scope and then discuss it in sandbox. – Howard – 2012-06-18T04:12:42.940
But I'll get rid of the extra credit line and make it part of the new question? – dspyz – 2012-06-18T04:23:39.400