I am not positive if this is on the right topic, let alone the right website, but I'll give it a shot.

I'm writing a computer program that computes sets. I have a basic computation that calculates the power sets with any number of elements. Part of the algorithm looks something like this

I know it's rough, and not complete as it doesn't output all the elements, but I don't have the code in front of me right now. Anyways, it's kind of irrelevant.for i = 0 to the number of elements - 1

for j = i + 1 to the number of elements - 1

output the the element with the index of i and the element with the index of j

What I need to figure out, now, is how to calculate the power set of a power set of a power set. If any of you can help me figure out an algorithm (probably using loops) that'd be great. If not, no big deal. This isn't a programming forum

Thanks for the help