tests/testthat/_snaps/partitions.md

combinations with repetition algorithm works

Code
  combinations_with_repetition(5, 3)
Output
  [[1]]
  [1] 1 1 1

  [[2]]
  [1] 1 1 2

  [[3]]
  [1] 1 1 3

  [[4]]
  [1] 1 1 4

  [[5]]
  [1] 1 1 5

  [[6]]
  [1] 1 2 2

  [[7]]
  [1] 1 2 3

  [[8]]
  [1] 1 2 4

  [[9]]
  [1] 1 2 5

  [[10]]
  [1] 1 3 3

  [[11]]
  [1] 1 3 4

  [[12]]
  [1] 1 3 5

  [[13]]
  [1] 1 4 4

  [[14]]
  [1] 1 4 5

  [[15]]
  [1] 1 5 5

  [[16]]
  [1] 2 2 2

  [[17]]
  [1] 2 2 3

  [[18]]
  [1] 2 2 4

  [[19]]
  [1] 2 2 5

  [[20]]
  [1] 2 3 3

  [[21]]
  [1] 2 3 4

  [[22]]
  [1] 2 3 5

  [[23]]
  [1] 2 4 4

  [[24]]
  [1] 2 4 5

  [[25]]
  [1] 2 5 5

  [[26]]
  [1] 3 3 3

  [[27]]
  [1] 3 3 4

  [[28]]
  [1] 3 3 5

  [[29]]
  [1] 3 4 4

  [[30]]
  [1] 3 4 5

  [[31]]
  [1] 3 5 5

  [[32]]
  [1] 4 4 4

  [[33]]
  [1] 4 4 5

  [[34]]
  [1] 4 5 5

  [[35]]
  [1] 5 5 5
Code
  combinations_with_repetition(3, 5)
Output
  [[1]]
  [1] 1 1 1 1 1

  [[2]]
  [1] 1 1 1 1 2

  [[3]]
  [1] 1 1 1 1 3

  [[4]]
  [1] 1 1 1 2 2

  [[5]]
  [1] 1 1 1 2 3

  [[6]]
  [1] 1 1 1 3 3

  [[7]]
  [1] 1 1 2 2 2

  [[8]]
  [1] 1 1 2 2 3

  [[9]]
  [1] 1 1 2 3 3

  [[10]]
  [1] 1 1 3 3 3

  [[11]]
  [1] 1 2 2 2 2

  [[12]]
  [1] 1 2 2 2 3

  [[13]]
  [1] 1 2 2 3 3

  [[14]]
  [1] 1 2 3 3 3

  [[15]]
  [1] 1 3 3 3 3

  [[16]]
  [1] 2 2 2 2 2

  [[17]]
  [1] 2 2 2 2 3

  [[18]]
  [1] 2 2 2 3 3

  [[19]]
  [1] 2 2 3 3 3

  [[20]]
  [1] 2 3 3 3 3

  [[21]]
  [1] 3 3 3 3 3


Try the nn2poly package in your browser

Any scripts or data that you put into this service are public.

nn2poly documentation built on July 18, 2026, 1:07 a.m.