Skip to main content
8 votes
Accepted

Generate vectors with a certain property

Solution without recursion. gen[n_Integer?Positive] := FoldList[#2 (#1 + #2) &, 0, #] & /@ Tuples[{0, 1}, n - 1] For ...
Edmund's user avatar
  • 43.1k
4 votes

Generate vectors with a certain property

This calls for a recursive function. ...
Daniel Huber's user avatar
  • 54.6k
2 votes
Accepted

How to sum with respect to partitions

This isn't very performant, but maybe it'll get you started. I'd start by defining a helper function to create the partitions. ...
lericr's user avatar
  • 31.7k
1 vote
Accepted

Finding Minimum Hamming Distance

For an example, I take 5 binary vectors of length 5: ...
Daniel Huber's user avatar
  • 54.6k
1 vote
Accepted

Add a new column based on the complement of column data in a table

Let's build this up bit by bit. At each step, there are probably several alternate ways to do it, so you might want to experiment to figure out exactly what you want. First, we need a representation ...
lericr's user avatar
  • 31.7k

Only top scored, non community-wiki answers of a minimum length are eligible