I am searching for a way to use the GAP System to find a solution of a linear Diophantine equation over the non-negative integers. Explicitly, I have a list L
of positive integers for each of which there exists a solution of the linear Diophantine equation s = 11*a + 7*b
such that a
and b
are non-negative integers. I would like to have the GAP System return for each element s
of L
the ordered pair(s) [a, b]
corresponding to the above solution(s).
I am familiar already with the command SolutionIntMat
in the GAP System; however, this produces only some solution of the linear Diophantine equation s = 11*a + 7*b
. Particularly, it is possible (and far more likely) that one of the coefficients a
and b
is negative. For instance, I obtain the solution [-375, 600]
when I use the aforementioned command on the linear Diophantine equation 75 = 11*a + 7*b
.
For additional context, this query arises when working with numerical semigroups generated by generalized arithmetic sequences. Use the command LoadPackage("numericalsgps");
to implement computations with such objects. For instance, if S := NumericalSemigroup(11, 29, 36, 43, 50, 57, 64, 71);
, then each of the minimal generators of S
other than 11
is of the form 2*11 + 7*i
for some integer i in [1..7]
. One can ask the GAP System for the SmallElements(S);
, and the GAP System will return all elements of S
up to FrobeniusNumber(S) + 1
. Clearly, every element of S
is of the form 11*a + 7*b
for some non-negative integers a
and b
; I would like to investigate what coefficients a
and b
arise. In fact, the answer is known (cf. Proposition 2.5 of this paper); I am just trying to get an understanding of the intuition behind the proof.
Thank you in advance for your time and consideration.
Dylan, thank you for your query and for using GAP
and numericalsgps
.
You can probably use in this setting Factorizations
from the package numericalsgps
. It internally rewrites the output of RestrictedPartitions
.
For instance, in your example, you can get all possible "factorizations" of the small elements of S
, with respect to the generators of S
, by typing List(SmallElements(S), x->[x,Factorizations(x,S)])
. A particular example:
gap> Factorizations(104,S);
[ [ 1, 0, 0, 1, 1, 0, 0, 0 ], [ 1, 0, 1, 0, 0, 1, 0, 0 ],
[ 1, 1, 0, 0, 0, 0, 1, 0 ], [ 3, 0, 0, 0, 0, 0, 0, 1 ] ]
If you want to see the factorizations of the elements of S
in terms of 11 and 7, then you can do the following:
gap> FactorizationsIntegerWRTList(29,[11,7]);
[ [ 2, 1 ] ]
So, for all minimal generators of S
you would do
gap> List(MinimalGenerators(S), g-> FactorizationsIntegerWRTList(g,[11,7]));
[ [ [ 1, 0 ] ], [ [ 2, 1 ] ], [ [ 2, 2 ] ], [ [ 2, 3 ] ],
[ [ 2, 4 ] ], [ [ 2, 5 ] ], [ [ 2, 6 ] ], [ [ 2, 7 ] ] ]
For the set of small elements of S
, try List(SmallElements(S), g-> FactorizationsIntegerWRTList(g,[11,7]))
. If you only want up to some integer, just replace SmallElements(S)
with Intersection([1..200], S)
; or if you want the first, say 200, elements of S
, use S{[1..200]}
.
You may want to have a look at Chapter 9 of the manual, and in particular to FactorizationsElementListWRTNumericalSemigroup
.
I hope this helps.