Items tagged with calculation

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.



i have two problem in maple file, that is attached..

one of them is RootOf...note that i suppose that [varepsilon := -2.3650203724313] for i can going on following calculation

and second is  Float(undefined) in calculation integral

please help me



How do I turn off Worksheet mode in a Maple Document.  I copied a calculation from a Worksheet into my Document, now I have to do calculation in 1-D math. 

Any advice would be helpful. 


I have experienced that maple does not save all of the varibles. But some it does.

I calculate with units, could that be the reason?

I have allso been thinking that it has something to do with saving the document online in onenote. But that works like the file is saved on the Pc's harddrive.

Are there anybody else that has experienced this?

I calculate with units, but as the varible does not appear in the calculation with units, I make one varible with the same result, to get the next calculation to work.   




at some point in my maple calculations I have to read some symbolic constants because otherwise the expressions become to big. All my constants are in a range 1e-3 to 1e6 or something. No matter how exact I calculate my result always has some Numbers in the range of <1e-20 (how small they actually are varies with Digits) together with numbers 1e-3..1e6. I presume those 1e-20 are just zeros. Can I somehow tell maple to forget/drop very small numbers and assume them all to be zero?



I am currently trying to solve a geometric problem where I have to calculate angles in two connected four bar linkages parallel to a serial chain of rotatory joints (closed-loop kinematic chain).

The angle is calculated with

 > alpha:=arctan(exp_y, exp_x):

The expressions exp_y and exp_x contain long products of sines and cosines of 6 other time-dependant angles, square roots of these products, constant geometric lengths (not time-dependant) and constant geometric angles (not time-dependant).

The lenghts are already assumed positive

 > assume (l1>0): # similar for all lengths l2, l3, ...

The time dependant angles are defined as

> qJ_t := Matrix(6, 1, [qJ1(t), qJ2(t), qJ3(t), qJ4(t), qJ5(t), qJ6(t)]): # generalized coordinates of the system in the sense of technical mechanics

Other assumptions are not set, since the angles can be positive as well as negative.

Calculating this expression takes up to two days on a fast computer. In my opinion this takes much too long compared to other calculations with similar amount of variables (more complex robotic structures).Also, the arctan function does not "calculate" a result, it just writes down "arctan(...)".

Is there a way to speed up this calculation e.g. by using more assumptions?

On the arctan help page, the examples suggest that Maple is trying to already simplify the solution e.g. by drawing Pi out of the solution.






I try make 2 calculation with one commant. So there should be two seperate answers in the last line. Who can help me? So the last line should be 2.387 and 0.

st := time():
ifactor(49! + 1);
(1021) (3119969417) (7374967) (139935066631148413819385559764102\

  5027693) (18503)
time() -st;
st := time():
isprime(49! + 1);
time() -st;



int(sin(x), x)



int(x^2, x)






How do I make maple to show the values of my variables in my calculation automatically? I want it to look somewhat like this:

Instead of this:


Dears, When I run calculation in Maple I found an error in matrices. See the file






could you help me about maple
i try to calculating using chevypade rational approximating and the answer for cos(x) xe is(-.221091073962959*T(1, x-1)+.7710737338*T(0, x-1)-0.4212446689e-1*T(2, x-1))/(0.836360586596837e-1*T(1, x-1)+T(0, x-1)+0.3360079945e-1*T(2, x-1)) i can not to convert to rational form as x^^n .maple is not very friendship

Hi, I am completely new to Maple, and I need to use it to optimize my equations in order to make my PLC codes more compressed. I am calculating forward kinematics with the Denavit-Hartenberg method and as such I get long expressions. After a lot of google'ing and frustration, I thought I'd ask here in the hope that one of you might be able to assist me.

I have the following equations;

X := L10*cos(q5) - L16*(sin(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) - cos(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) - d2*(cos(q10)*(sin(q5)*sin(q8) - cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + sin(q10)*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)))) + L15*(sin(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + cos(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6))) - L11*cos(q5)*sin(q6) + d1*cos(q5)*cos(q6) - L13*sin(q5)*sin(q8) + L14*cos(q9)*(cos(q8)*sin(q5) + sin(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7))) + L13*cos(q8)*(cos(q5)*cos(q6)*cos(q7) - cos(q5)*sin(q6)*sin(q7)) - L14*sin(q9)*(cos(q5)*cos(q6)*sin(q7) + cos(q5)*cos(q7)*sin(q6)) + L12*cos(q5)*cos(q6)*cos(q7) - L12*cos(q5)*sin(q6)*sin(q7);

Y := L10*sin(q5) - L9 + L16*(sin(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) + d2*(cos(q10)*(cos(q5)*sin(q8) - cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) + sin(q10)*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)))) - L15*(sin(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - cos(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6))) + L13*cos(q5)*sin(q8) - L11*sin(q5)*sin(q6) + d1*cos(q6)*sin(q5) - L14*cos(q9)*(cos(q5)*cos(q8) + sin(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5))) - L13*cos(q8)*(sin(q5)*sin(q6)*sin(q7) - cos(q6)*cos(q7)*sin(q5)) - L14*sin(q9)*(cos(q6)*sin(q5)*sin(q7) + cos(q7)*sin(q5)*sin(q6)) + L12*cos(q6)*cos(q7)*sin(q5) - L12*sin(q5)*sin(q6)*sin(q7);

Z := L15*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L11*cos(q6) - L8 - d1*sin(q6) + L16*(cos(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - cos(q8)*sin(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - d2*(sin(q10)*(cos(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - sin(q8)*sin(q9)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) + cos(q8)*cos(q10)*(cos(q6)*sin(q7) + cos(q7)*sin(q6))) - L13*cos(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6)) - L14*sin(q9)*(cos(q6)*cos(q7) - sin(q6)*sin(q7)) - L12*cos(q6)*sin(q7) - L12*cos(q7)*sin(q6) - L14*cos(q9)*sin(q8)*(cos(q6)*sin(q7) + cos(q7)*sin(q6));


I need to optimize these equations, but still keep them separate. I would like to use mutual expressions for the calculations within, but still as I said keep the outputs of X, Y and Z separate.

This is MATLAB code.


Thanks in advance for any help.

Dear Community Members,


We have problem with calculation in Maple v11 and v18. when we make a calculation by using maple v11 and v18, we was not able to get the solution as you see enclosed. when we clicked to "enter + ; ", programme does not run.

1. for example how to convert decimal or integer number into base 3 number, base 5 number etc. to do logical operation with custom logic table for example,


120 special operator 235 




special operator according to logical table is

1st op 2nd op output
0 0 1
0 1 0
1 0 1
1 1 0




=00010100 = 20

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