I have estimated the complexity of my numerical experiment like this:
complexity[{n,k}] := Binomial[n+k-1, k]
I want to prepare a list of {n,k}
pairs with ascending complexity up to a certain complexity. I am only interested in k>0
and n>1
.
My very naive approach is to generate a big list and filter it:
pairsUpToComplexity[limit_] :=
Select[complexity[#] <= limit &]@
Flatten[ Table[{n, k}, {n, 2, limit}, {k, 1, limit}], 1] //
SortBy[complexity]
However, this is not efficient at all. For example, pairsUpToComplexity[1000]
generates a table of 999000 pairs and then filters it down to 2124. The complexity of the list generation seems to high itself...