Reptorian's Combinatorics Library: Sum-constrained Permutations
Description
Combinatorics tools for non-negative integers where the valuesare restricted by a maximum sum constraint.
For example, { 1,4,2 } is valid sequence when N = 7.
Examples:
rep_sum_permutation(s)_
Generates sequences of permutations of integer numbers that sums up to N.$ +rep_sum_permutations 3,2 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,0
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 3,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (10,1,1,2) [80 b of float32].
data = (0,0,0,0,1,1,1,2,2,3^0,1,2,3,0,1,2,0,1,0).
min = 0, max = 3, mean = 1, std = 1, coords_min = (0,0,0,0), coords_max = (9,0,0,0).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,0
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ 2,0
[gmic]./ 2,1
[gmic]./ 3,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (10,1,1,2) [80 b of float32].
data = (0,0,0,0,1,1,1,2,2,3^0,1,2,3,0,1,2,0,1,0).
min = 0, max = 3, mean = 1, std = 1, coords_min = (0,0,0,0), coords_max = (9,0,0,0).
[gmic]./ End G'MIC interpreter.
rep_total_sum_permutation(s)_
Generates sequences of permutations of integer numbers that sums up exactly to N.$ +rep_total_sum_permutations 5,3 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0,5
[gmic]./ 0,1,4
[gmic]./ 0,2,3
[gmic]./ 0,3,2
[gmic]./ 0,4,1
[gmic]./ 0,5,0
[gmic]./ 1,0,4
[gmic]./ 1,1,3
[gmic]./ 1,2,2
[gmic]./ 1,3,1
[gmic]./ 1,4,0
[gmic]./ 2,0,3
[gmic]./ 2,1,2
[gmic]./ 2,2,1
[gmic]./ 2,3,0
[gmic]./ 3,0,2
[gmic]./ 3,1,1
[gmic]./ 3,2,0
[gmic]./ 4,0,1
[gmic]./ 4,1,0
[gmic]./ 5,0,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (21,1,1,3) [252 b of float32].
data = (0,0,0,0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5^0,1,2,3,4,5,0,1,2,3,4,0,1,2,3,0,1,2,0,1,0^5,4,3,2,1,0,4,3,2,1,0,3,2,1,0,2,1,0,1,0,0).
min = 0, max = 5, mean = 1.66667, std = 1.49071, coords_min = (0,0,0,0), coords_max = (20,0,0,0).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0,5
[gmic]./ 0,1,4
[gmic]./ 0,2,3
[gmic]./ 0,3,2
[gmic]./ 0,4,1
[gmic]./ 0,5,0
[gmic]./ 1,0,4
[gmic]./ 1,1,3
[gmic]./ 1,2,2
[gmic]./ 1,3,1
[gmic]./ 1,4,0
[gmic]./ 2,0,3
[gmic]./ 2,1,2
[gmic]./ 2,2,1
[gmic]./ 2,3,0
[gmic]./ 3,0,2
[gmic]./ 3,1,1
[gmic]./ 3,2,0
[gmic]./ 4,0,1
[gmic]./ 4,1,0
[gmic]./ 5,0,0
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (21,1,1,3) [252 b of float32].
data = (0,0,0,0,0,0,1,1,1,1,1,2,2,2,2,3,3,3,4,4,5^0,1,2,3,4,5,0,1,2,3,4,0,1,2,3,0,1,2,0,1,0^5,4,3,2,1,0,4,3,2,1,0,3,2,1,0,2,1,0,1,0,0).
min = 0, max = 5, mean = 1.66667, std = 1.49071, coords_min = (0,0,0,0), coords_max = (20,0,0,0).
[gmic]./ End G'MIC interpreter.
rep_sum_combination(s)_
Generates sequences of combinations of integer numbers that sums up to N.$ +rep_sum_combinations 3,2 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (6,1,1,2) [48 b of float32].
data = (0,0,0,0,1,1^0,1,2,3,1,2).
min = 0, max = 3, mean = 0.916667, std = 0.953794, norm = 4.58258, coords_min = (0,0,0,0), coords_max = (3,0,0,1).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0
[gmic]./ 0,1
[gmic]./ 0,2
[gmic]./ 0,3
[gmic]./ 1,1
[gmic]./ 1,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (6,1,1,2) [48 b of float32].
data = (0,0,0,0,1,1^0,1,2,3,1,2).
min = 0, max = 3, mean = 0.916667, std = 0.953794, norm = 4.58258, coords_min = (0,0,0,0), coords_max = (3,0,0,1).
[gmic]./ End G'MIC interpreter.
rep_total_sum_combination(s)_
Generates sequences of combinations of integer numbers that sums up exactly to N.$ +rep_total_sum_combinations 5,3 repeat w { e[0] {I[#-1,$>]} }
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0,5
[gmic]./ 0,1,4
[gmic]./ 0,2,3
[gmic]./ 1,1,3
[gmic]./ 1,2,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (5,1,1,3) [60 b of float32].
data = (0,0,0,1,1^0,1,2,1,2^5,4,3,3,2).
min = 0, max = 5, mean = 1.66667, std = 1.49071, norm = 8.66025, coords_min = (0,0,0,0), coords_max = (0,0,0,2).
[gmic]./ End G'MIC interpreter.
[gmic]./ Start G'MIC interpreter (v.3.7.3).
[gmic]./ 0,0,5
[gmic]./ 0,1,4
[gmic]./ 0,2,3
[gmic]./ 1,1,3
[gmic]./ 1,2,2
[gmic]./ Display image [0] = '[unnamed]'.
[0] = '[unnamed]':
size = (5,1,1,3) [60 b of float32].
data = (0,0,0,1,1^0,1,2,1,2^5,4,3,3,2).
min = 0, max = 5, mean = 1.66667, std = 1.49071, norm = 8.66025, coords_min = (0,0,0,0), coords_max = (0,0,0,2).
[gmic]./ End G'MIC interpreter.


Home
Download
News
Mastodon
Bluesky
X
Summary - 18 Years
Summary - 17 Years
Summary - 16 Years
Summary - 15 Years
Summary - 13 Years
Summary - 11 Years
Summary - 10 Years
Resources
Technical Reference
Scripting Tutorial
Video Tutorials
Wiki Pages
Image Gallery
Color Presets
Using libgmic
G'MIC Online
Community
Discussion Forum (Pixls.us)
GimpChat
IRC
Report Issue