Items tagged with integer

Let us consider the linear integer programming problem:

A := Matrix([[1, 7, 1, 3], [1, 6, 4, 6], [17, 1, 5, 1], [1, 6, 10, 4]]):
 n := 4; z := add(add(A[i, j]*x[i, j], j = 1 .. n), i = 1 .. n):
restr := {seq(add(x[i, j], i = 1 .. n) = 1, j = 1 .. n), seq(add(x[i, j], j = 1 .. n) = 1, i = 1 .. n)}:
 sol := Optimization[LPSolve](z, restr, assume = binary);

Error, (in Optimization:-LPSolve) no feasible integer point found; 
use feasibilitytolerance option to adjust tolerance

sol1 := Optimization[LPSolve](z, restr, assume = binary, feasibilitytolerance = 100, integertolerance = 1);

Error, (in Optimization:-LPSolve) no feasible integer point found;
 use feasibilitytolerance option to adjust tolerance

That was OK in Maple 16, outputting


The bug in one of the principal Maple commands lasts since Maple 2015, where the above code causes "Kernel connection has been lost". The SCRs about it were submitted three times (see

Friends in Maple

I have a Vehicle Routing Problem I wish to cast as a integer model. VRP is a kind of TSP and knapsack problem hybrid  I would be grateful if someone can finish it. answers included. This isn't homework BTW.


I know there are other methods to solve this classic probem, but I wanted to cast it as a linear program. I wonder if an expert can look at my IP coding and please correct my error.

sorry its a mishmash of 1D and 2D inputs


I am working on a Dirichlet breakdown of primes. I need a way to check if a number is part of anothers number factorization.

Example: 30 = 2*3*5.

2 is therefore part of the ifactor of 30. 4 and 7 are not.
How do I check if, for instance, 7 is part of de factorization of 390?

Thanks in advance.

I'd like to solve 178x + 312y = 14

I tried:


But Maple wouldn't solve this, so I did


This gave x = 145 en y = -103, while according to the answers it should be x = -49 en y = 28.

145*178-103*312 is NOT 14, so something does indeed go wrong.


Can Maple solve this even better? Like in one go, with 178,312,x,y and 14 in one argument?



I am having trouble with understanding how to use piecewise to define a function f such that

f(x) = 1 whenever the VALUE of x is an integer (thus f((2^(0.5) - 1.0)*(2^(0.5) + 1.0)) = 1).

f(x) = 0 otherwise.


A prime producing polynomial.


Observations on the trinomial n2 + n + 41.


by Matt C. Anderson


September 3, 2016


The story so far


We assume that n is an integer.  We focus our attention on the polynomial n^2 + n + 41.


Furthur, we analyze the behavior of the factorization of integers of the form


h(n) = n2 + n + 41                                          (expression 1)


where n is a non-negative integer.  It was shown by Legendre, in 1798 that if 0 ≤ n < 40 then h(n) is a prime number.


Certain patterns become evident when considering points (a,n) where


h(n) ≡ 0 mod a.                                             (expression 2)


The collection of all such point produces what we are calling a "graph of discrete divisors" due to certain self-similar features.  From experimental data we find that the integer points in this bifurcation graph lie on a collection of parabolic curves indexed by pairs of relatively prime integers.  The expression for the middle parabolas is –


p(r,c) = (c*x – r*y)2 – r*(c*x – r*y) – x + 41*r2.           (expression 3)


The restrictions are that 0<r<c and gcd(r,c) = 1 and all four of r,c,x, and y are integers.


Each such pair (r,c) yields (again determined experimentally and by observation of calculations) an integer polynomial a*z2 + b*z + c, and the quartic h(a*z2 + b*z + c) then factors non-trivially over the integers into two quadratic expressions.  We call this our "parabola conjecture".  Certain symmetries in the bifurcation graph are due to elementary relationships between pairs of co-prime integers.  For instance if m<n are co-prime integers, then there is an observable relationship between the parabola it determines that that formed from (n-m, n).


We conjecture that all composite values of h(n) arise by substituting integer values of z into h(a*z2 + b*z + c), where this quartic factors algebraically over Z for a*z2 + b*z + c a quadratic polynomial determined by a pair of relatively prime integers.  We name this our "no stray points conjecture" because all the points in the bifurcation graph appear to lie on a parabola.


We further conjecture that the minimum x-values for parabolas corresponding to (r, c) with gcd(r, c) = 1 are equal for fixed n.  Further, these minimum x-values line up at 163*c^2/4 where c = 2, 3, 4, ...  The numerical evidence seems to support this.  This is called our "parabolas line up" conjecture.


The notation gcd(r, c) used above is defined here.  The greatest common devisor of two integers is the smallest whole number that divides both of those integers.


Theorem 1 - Consider h(n) with n a non negative integer. 

h(n) never has a factor less than 41.


We prove Theorem 1 with a modular construction.  We make a residue table with all the prime factors less than 41.  The fundamental theorem of arithmetic states that any integer greater than one is either a prime number, or can be written as a unique product of prime numbers (ignoring the order).  So if h(n) never has a prime factor less than 41, then by extension it never has an integer factor less than 41.


For example, to determine that h(n) is never divisible by 2, note the first column of the residue table.  If n is even, then h(n) is odd.  Similarly, if n is odd then h(n) is also odd.  In either case, h(n) does not have factorization by 2.


Also, for divisibility by 3, there are 3 cases to check.  They are n = 0, 1, and 2 mod 3. h(0) mod 3 is 2.  h(1) mod 3 is 1. and h(2) mod 3 is 2.  Due to these three cases, h(n) is never divisible by 3.  This is the second column of the residue table.


The number 0 is first found in the residue table for the cases h(0) mod 41 and h(40) mod 41.  This means that if n is congruent to 0 mod 41 then h(n) will be divisible by 41.  Similarly, if n is congruent to 40 mod 41 then h(n) is also divisible by 41.

After the residue table, we observe a bifurcation graph which has points when h(y) mod x is divisible by x.  The points (x,y) can be seen on the bifurcation graph.


< insert residue table here >


Thus we have shown that h(n) never has a factor less than 41.


Theorem 2


Since h(a) = a^2 + a + 41, we want to show that h(a) = h( -a -1).


Proof of Theorem 2

Because h(a) = a*(a+1) + 41,

Now h(-a -1) = (-a -1)*(-a -1 +1) + 41.

So h(-a -1) = (-a -1)*(-a) +41,

And h(-a -1) = h(a).

Which was what we wanted.

End of proof of theorem 2.


Corrolary 1

Further, if h(b) mod c ≡ = then h(c –b -1) mod c ≡ 0.


We can observe interesting patterns in the “graph of discrete divisors” on a following page.


This sequence has a special name does anyone know what it is? i mean id look it up on oeis but unfortunately the asthetics of their presentation dont meet my strict standards, so yes i did work out an expression for it but if anyone knows the easiest in a singular expression.. very helpful right now.


1, 1, 2, 2, 3, 3, 4, 4, 5, 5

Hello, I run Maple to solve Binary Integer Programming problem which contain about 1340 constraint and its goal to maximize the objective function.

At first, it's running for 2 hours and said that the iteration limit was reached. So I try to add 'iterationlimit' at LPSolve opts and set it to 10000, but after 3 or 4 hours it said that the iteration limit was reached. So I set 'iterationlimit' to 100000000 and now Maple keep evaluating more than 12 hours.

I run Maple at my notebook with these spesification:

Processor: Intel Corei3-5005U 2.0 GHz

Memory: 4GB RAM

Windows 10


It is normal? Or I must run Maple in higher notebook spesification?

Thank you in advance.


Below is my Maple file, hope you can help me.

I apologize, as I'm still very new. I've flipped through a lot of pages, but I'm unsure of how Maple code translates to Maple TA.


I have randomly assigned an integer for the value of a year in Maple TA. I'd like it to appear as "2013" for example, but it will instead appear as "2,013". Is there a way to set the output formatting of a variable individually within a problem in TA?


Dear all,

I wold like to find the solution of the next system of two equations with three unknowns but we assume that the unknows are positive integers. How the following code can work. Many thanks




> restart;
> assume(J, integer, J >= 0);
> assume(A, integer, A >= 0);
> assume(T, integer, T >= 0);
> eq1 := J+10*A+50*T=500;
   eq2 := J+A+T = 100;
  solve( {eq1,eq2},{J,A,T});

if you want a random interger between 0 and 100

what will be the command?

Hi Maple Primes

I have this parabola -

y2:=6z^2 +z+244;


I use the eliminate command to write without z;


Then I have the expression

e2 = 4x^2-12xy+9y^2-7x+9y+369.

My questions is, what integer values for x and y are on the curve e2?

I think the answer may be exactly when z is an integer.

How could I determine this given only e2?





Hi, anyone know hot i need to continue my command to get 462 from [4,6,2]?

Thank you~=]]




Hi, how i need to continue my command to get [4,6,8] from 468?

Thank you~=]]

1 2 3 4 5 6 7 Last Page 1 of 23