## a look at recursive functions

Maple 13

Hi MaplePrimes,

another_recursive_sequence.mw

another_recursive_sequence.pdf

These two files have the same content.  One is a .pdf and the other is a Maple Worksheet.  I explore integer sequences of the form -

a(r) = c*a(r-1)+d*a(r-2) with a(1) and a(2) given.

Some of these sequences are in (the Online Encyclopedia of Integer Sequences) OEIS.org and some are not.  If we restrict c to 1 and assume that a(1)=1 and a(2) = 2 we have the parameter d remaining.  See additional webpage -

Let me know if you like the code.

Regards,

Matt

## an obscure sequence...

HI experts,

fibonacci_sequence_with_coefficient.pdf

Is there a Last name associated with a double 'hailstone problem' with variable integer coefficients?

Just curious.

Regards,

Matt

## How to solve a VRP ...

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.

## TSP integer program problem...

Hello

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.

TSP_IP.mw

sorry its a mishmash of 1D and 2D inputs

## Check if an integer is part of the factorisation o...

Hello,

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?

## How do I solve a diophantine equation in Maple?...

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

I tried:

a=178,b=312:
c=igcdex(a,b,'e','f');
14/c*e=x;14/c*f=y;

But Maple wouldn't solve this, so I did

c=igcdex(178,312,'e','f');
14/c*e=x;14/c*f=y;

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?

## define an integer predicate ...

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.

## Composite number producing polynomial

Maple 13

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.

## discrete sequence...

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

## Maple Evaluating More Than 12 hrs...

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?

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

ISL_2017_FASE3.mw

## Formatting output of variables in Maple TA...

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?

Thanks!

## Integer solution of system...

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});

## Integer from list of its digits?...

>nombor1:=[4,6,2];

nombor1:=[4,6,2]

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

Thank you~=]]

## Code for integer points on sphere...

I use Mathematica. This code finds integer points on the sphere

(x-2)^2 + (y-4)^2 + (c-6)^2 =15

and select two of them so that distance of two this points equal to 4.

ClearAll[a, b, r, c];
a = 2;
b = 4;
c = 6;
r = 15; ss =
Subsets[{x, y, z} /.
Solve[{(x \[Minus] a)^2 + (y \[Minus] b)^2 + (z \[Minus] c)^2 ==
r^2, x != a, y != b, z != c, x y z != 0}, {x, y, z},
Integers], {2}];
t = Select[ss, And @@ Unequal @@@ Subsets[Flatten[#], {2}] &];
Length[t]
Select[ss, Apply[EuclideanDistance, #] === 4 &]

and this code select four points on the shere so that none of three points make a right triangle

ClearAll[a, b, r, c];
a = 2;
b = 4;
c = 6;
r = 15;
ss = Subsets[{x, y, z} /.
Solve[{(x - a)^2 + (y - b)^2 + (z - c)^2 == r^2, x != a, y != b,
z != c, x y z != 0, x > y}, {x, y, z}, Integers], {4}];
nonright =
Pick[ss, (FreeQ[#, \[Pi]/2] &) /@ ({VectorAngle[#2 - #1, #3 - #1],
VectorAngle[#1 - #2, #3 - #2],
VectorAngle[#1 - #3, #2 - #3]} & @@@ ss)];
Select[nonright, (12 == Length[Union @@ #] &)]

I am looking for a  procedure in Maple.  I have some problems with this sphere. For example:

Choose four points so that 12 coordinates difference and it makes a square.

Can your code improve with sphere?

## Problem with integer optimization...

When I use the option assume = nonnegint or integervariables = {...} in Optimization[Minimize], or Optimization[LPSolve] I've got the message "kernel connection lost'.

Thie even happens when I use the simple example from the Maple help:

with(Optimization):
LPSolve(2*x+5*y,{3*x-y=1,x-y<=5},assume={nonnegative,integer});

It says; mserver.exe has stopped working.

What's wrong?

 1 2 3 4 5 6 7 Last Page 1 of 21
﻿