New answers tagged

3

This is a very quick-and-dirty, but gives 4X speed-up (7X with tweak for symmetry) on my crappy netbook for the n=8 case, don't have time or patience to test bigger cases to see scaling differences. Perhaps a description of what you're trying to calculate? It appears to be some combinatorial problem, there may well be a much more efficient scheme to do ...


7

ClearAll[fuzzyLCS]; fuzzyLCS[strings__List] := Module[ {subsets, aligned, intersections}, subsets = Subsets[strings, {2, Length@strings}]; aligned = Select[SequenceAlignment[#[[1]], #[[2]]], StringQ[#] &] & /@ subsets; intersections = Intersection @@ (Subsets[#, {1, Length@#}] & /@ (Flatten[Characters[#]] & /@ ...


1

You could introduce further conditional definitions for H which will prevent those computations whose results would end up being thrown away. For instance, you could add: H[i_, j_, k_, l_] /; (i > j || k > l) = Missing[]; As a toy example: m = Table[H[n, 2, 3, 4], {n, 1, 10}] (* Out: {(3 Sqrt[5])/128, (5 Sqrt[15])/256, Missing[], Missing[], ...


5

I needed the following two functions: Times @@@ (Map[Max, SetPartitions[n], {2}] + n + 1) Map[Length, SetPartitions[n], {2}]


7

Sure, try for example: pr[14709321003111578837870501266345370175409, 2, 2] There are many things in MMA where small cases/edge cases can be done much more quickly with user code, this is one of them. The advantage here is that PowersRepresentation can handle huge cases...



Top 50 recent answers are included