in reply to Re^2: All possible number combinations in perl
in thread All possible number combinations in perl
From your example, it doesn't look like you are interested in combinations (otherwise, 235 would be included in your result), but in complete subsequences of a sequence 1..n. Hence, if N equals 100, the subsequence 42 43 44 45 would be in your result set. Right?
In this case, you just need two nested loops (one for the lower bound of the subsequence, one for the upper bound). There are N*N of such subsequences.
|
|---|