Skip to main content
incorporation of TomD's suggestion
Source Link
DavidC
  • 16.8k
  • 1
  • 42
  • 94

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1
 

EDIT: Here's another way to solve it via Permutations:

Select[Permutations[Range@16, {2}], #[[2]] > #[[1]] &]

As TomD noted, this can be expressed alternatively as:

Select[Permutations[Range@16, {2}], OrderedQ]

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1

EDIT: Here's another way to solve it via Permutations:

Select[Permutations[Range@16, {2}], #[[2]] > #[[1]] &]

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1
 

EDIT: Here's another way to solve it via Permutations:

Select[Permutations[Range@16, {2}], #[[2]] > #[[1]] &]

As TomD noted, this can be expressed alternatively as:

Select[Permutations[Range@16, {2}], OrderedQ]
second solution proposed.
Source Link
DavidC
  • 16.8k
  • 1
  • 42
  • 94

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1

EDIT: Here's another way to solve it via Permutations:

Select[Permutations[Range@16, {2}], #[[2]] > #[[1]] &]

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1

EDIT: Here's another way to solve it via Permutations:

Select[Permutations[Range@16, {2}], #[[2]] > #[[1]] &]
Source Link
DavidC
  • 16.8k
  • 1
  • 42
  • 94

@acl showed the best way. Because your list is defined as a Range, the particular solution for the case you gave is also found by

Table[{j, k}, {j, 15}, {k, j + 1, 16}]~Flatten~1