perlquestion
Limbic~Region
All,
<br />
I am trying to improve my solution to [432558|this] problem by incorporating the shortcuts I outlined [434153|here]. This requires ordering the powerset of prime factors in some sort of progressive order:
<readmore>
<CODE>
input = 2, 3, 5, 7
output:
2
2 3
2 3 5
2 3 5 7
-------
2 3 7
-------
2 5
2 5 7
-------
2 7
-------
3
3 5
3 5 7
-------
3 7
-------
5
5 7
-------
7
-------
</CODE>
</readmore>
<p>
In this simple example, the number is 210 so any factor larger than 14 need not be considered. This means that after checking 2*3*5, we can skip 2*3*5*7 and after we check 3*5, we can skip 3*5*7.
</p>
<p>
Additional savings can be found if the primes repeat since it will lead to duplicate subsets. Prior to determining the product of the subset, we can easily determine if we have already seen this subset and skip. If this previously seen subset was also too large, we can skip the entire progression.
</p>
<p>
Anyone have any ideas about how to implement this?
</p>
<div class="pmsig"><div class="pmsig-180961">
<p>
Cheers - [Limbic~Region|L~R]
</p>
</div></div>
<p>
<b>Update:</b> You can see the result of this exercise [434740|here]
</p>