Tag Info

New answers tagged

1

Here's a way than works for any number of variables: numbering = 2^(Length[#] - 1) (2 - FromDigits[#, 1/2]) &; tablesubset = Reverse /@ Reverse@Tuples[{0, 1}, {3}][[All, {1, 3}]]; (* {A, C} *) Grid@Join[#, List /@ numbering /@ #, 2] &@ tablesubset (If all you want is a numbering, then just FromDigits[#, 2] & seems quite easy, as well as ...


1

I post this (it was an approach to a New York Times NumberPlay). Note there are major scaling issues for this (Hamiltonian cycles). Apologies if this is unhelpful. Some examples: f[k_, n_] := (k!)^k^(n - 1)/k^n fun[alpha_, n_] := Module[{t, g, gp}, t = Tuples[alpha, n]; g = Map[Function[x, {#, Take[Join[#, {x}], -n]}], alpha] & /@ t; gp = ...


1

An idea for a workaround, but the Permutations is pretty inefficient and quickly burns through memory. Any ideas how to improve this? DeBruijnGraph[3, 1] // EdgeList Cases[ Permutations[List @@@ %], x_ /; x[[;; -2, 2]] == x[[2 ;;, 1]]]; NestWhile[ RotateLeft, #, First@# != {1, 1} &] & /@ % // DeleteDuplicates; Apply[DirectedEdge, %, {2}] ...


2

As has been calculated by combinatorial considerations there will be 4*3^5 =972 flags. This can be done with Mathematica (as small enough for brute force): tu = Tuples[Table[{Yellow, Blue, Green, Red}, {6}]]; dtu = DeleteCases[tu, {___, x_, x_, ___}]; Length@dtu yields 972. (as has been pointed out by eldo this is essentially as per Bob Hanlon) The ...



Top 50 recent answers are included