Items tagged with integer integer Tagged Items Feed

Hi Maple Primes

I have this parabola -

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

x2:=9z^2+3z+367;

I use the eliminate command to write without z;

c:=eliminate([y=y2,x=x2],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?

Regards,
Matt

>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~=]]

>mylist:=468;

mylist:=468

 

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

Thank you~=]]

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?

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? 

How can I generate some n-tuple random list of integers s.t. any component is between -30 and 50? For example if n=5 then four random of such 5-tuple are

[-1,2,8,7,9] , [0,-9,2,-3,-5] , [4,5,3,-8,-1] , [12, -5, 0, 6,8]

Let x and y be 4-digit integers such that the last digit of x is 7 and the last digit of y is 1. That is, x = abc7 and y = rst1, where a,b,c,r,s,t all run from 0 to 9. There are 1000 possibilities for x and  1000 for y. What are all possible products x*y? I would like all possible products listed in increasing order. The first element of the list should be 7*1 = 7 (since 0007*0001 = 7). The last should be 9997*9991 = 99880027. Thank you! 

How to find the maximum natural number n s. t. the sum of its cubed digits is greater than or equal to n? Of course, with Maple. The same question for the sum of the  digits to k-th power. Here are my unsuccessful attempts:
1.Optimization:-Maximize(n, {n <= convert(map(c ->c^3, convert(n, base, 10)), `+`)}, assume = integer);

Error, invalid input: `convert/base` expects its 1st argument, n, to be of type {integer, list(integer)}, but received n


2. for n while n <= convert(map(c ->c^3, convert(n, base, 10)), `+`) do print(n) end do;

                               1
                               2
                               3
                               4
                               5
                               6
                               7
                               8
                               9

Let M and K be given positive integers.

I struggle with how to write efficiently this formula in Maple,mainly because it sums over *pairs* of integers K1 and K2, with the given property that "K1+2*K2=K":

0<=K1<=K,

0<=K2<=K/2

 

sum { M!/(M-K1-K2)! * K!/(K1! * K2)! * 1/M^K * 1/2^K2 : such that K1 + 2*K2 = K}

The "!" means factorial.

I currently have a function quadsum(n) that determines the [x,y] solutions of the above equation for an integer n. :

quadsum:= proc(n::nonnegint)
local
k:= 0, mylist:= table(),
x:= isqrt(iquo(n,2)), y:= x, x2:= x^2, y2:= y^2;
if 2*x2 <> n then x:= x+1; x2:= x2+2*x-1; y:= x; y2:= x2; end if;
while x2 <= n do
y:= isqrt(n-x2); y2:= y^2;
if x2+y2 = n then k:= k+1; mylist[k]:= [x,y] end if;
x:= x+1; x2:= x2+2*x-1;
end do;
convert(mylist, list)
end proc:

How would I alter this so that I get [x,y] for n= (5^a).(13^b).(17^c)(29^d) for non-negative integers a,b,c,d?

1.  a procedure quadsumstats whose input is an integer n. This procedure should return a list of length 

n whose kth  entry is the number of solutions to
x^2 + y^2 = k 
for
1 <= k and k <= n

I am sort of confused as to how to construct that list of length n and how to obtain integer solutions to the equation in maple.

2.

a procedure firstCount(k) that finds the first integer
n
with
k
representations as
"x^2+y^2= n." What does it mean for an integer to have k representations?

 

 

 

 

The procedure  Partition  significantly generalizes the standard procedure  combinat[partition]  in several ways. The user specifies the number of parts of the partition, and can also set different limitations on parts partition.

Required parameters:  n - a nonnegative integer, - a positive integer or a range (k  specifies the number of parts of the partition). The parameter  res  is the optional parameter (by default  res is  ). If  res  is a number, all elements of  k-tuples must be greater than or equal  res .  If  res  is a range  a .. b ,   all elements of  k-tuples must be greater than or equal  a  and  less than or equal  b . The optional parameter  S  - set, which includes elements of the partition. By default  S = {$ 0.. n} .

The code of the procedure:

Partition:=proc(n::nonnegint, k::{posint,range}, res::{range, nonnegint} := 1, S::set:={$0..n})  # Generates a list of all partitions of an integer n into k parts

local k_Partition, n1, k1, L;

 

k_Partition := proc (n, k::posint, res, S)

local m, M, a, b, S1, It, L0;

m:=S[1]; M:=S[-1];

if res::nonnegint then a := max(res,m); b := min(n-(k-1)*a,M)  else a := max(lhs(res),m); b := min(rhs(res),M) fi;

S1:={$a..b} intersect S;

if b < a or b*k < n or a*k > n  then return [ ] fi;

It := proc (L)

local m, j, P, R, i, N;

m := nops(L[1]); j := k-m; N := 0;

for i to nops(L) do

R := n-`+`(op(L[i]));

if R <= b*j and a*j <= R then N := N+1;

P[N] := [seq([op(L[i]), s], s = {$ max(a, R-b*(j-1)) .. min(R, b)} intersect select(t->t>=L[i,-1],S1) )] fi;

od;

[seq(op(P[s]), s = 1 .. N)];

end proc;

if k=1 then [[b]] else (It@@(k-1))(map(t->[t],S1))  fi;

end proc;

 

if k::posint then return k_Partition(n,k,res,S) else n1:=0;

for k1 from lhs(k) to rhs(k) do

n1:=n1+1; L[n1]:=k_Partition(n,k1,res,S)

od;

L:=convert(L,list);

[seq(op(L[i]), i=1..n1)] fi;

 

end proc:

 

Examples of use:

Partition(15, 3);

 

 

Partition(15, 3..5, 1..5);  # The number of parts from 3 to 5, and each summand from 1 to 5

 

 

Partition(15, 5, {seq(2*n-1, n=1..8)});  # 5 summands and all are odd numbers 

 

 

A more interesting example.
There are  k banknotes in possible denominations of 5, 10, 20, 50, 100 dollars. At what number of banknotes  k  the number of variants of exchange  $140  will be maximum?

n:=0:

for k from 3 to 28 do

n:=n+1: V[n]:=[k, nops(Partition(140, k, {5,10,20,50,100}))];

od:

V:=convert(V, list);

max(seq(V[i,2], i=1..nops(V)));

select(t->t[2]=8, V);

 

Here are these variants:

Partition(140, 10, {5,10,20,50,100});

Partition(140, 13, {5,10,20,50,100});

 

 Partition.mws

 

 

 

According to this site,"It is known that every even number can be written as a sum of at most six primes". 

http://www.theage.com.au/national/education/christians-goldbachs-magic-sum-20140903-3es2t.html

i wanted to test this using maple.

restart:
> PF := proc (a::integer)

> local cst,obj,res;
> cst := add(x[i], i = 1 .. numtheory:-pi(prevprime(a))) <= 6;
> obj := add(x[i]*ithprime(i), i = 1 .. numtheory:-pi(prevprime(a)))-a;
> res := Optimization:-LPSolve(obj, {cst ,obj>=0}, assume={nonnegative,integer}); end proc:
> PF(30);
[0, [x[1] = 0, x[2] = 0, x[3] = 6, x[4] = 0, x[5] = 0, x[6] = 0,x[7] = 0, x[8] = 0, x[9] = 0, x[10] = 0]]

the third prime is 5 and 6 of them make 30. as an aside, it would be nice to know how to get maple to output "30 = 6x5".

this is obviously pretty limited, because 30 can be written as the sum of two primes (7+23 and 11+19) [GOLDBACH], but using DS's GlobalSearch for all solutions takes a long time to compute. also I have to nominate the highest prime.

any suggestions?

I'm interested in doing some experimental mathematics using the PSLQ integer relation algorithm.  The only third-party program for doing PSLQ problems I've been able to find is a GNU C++ program with a less-than-user-friendly command-line interface.  I've heard that Maple implements PSLQ and I like the symbolic input and presentation it offers as a CAS, but I can't find any information on which alternative types of Maple 18 make the PSLQ algorithm available.

 

 

so we have to Write a maple function with -> that takes an integer N and a boolean function

F: {(i,j) l 0<= i,j<= N} -> {true,false} 


and returns a list containing all [i,j] such that F(i,j). A procedure that does this
would be


proc(N,F) local i, j, RV;
RV:=NULL;
for i from 1 to N do for j from 1 to N do
if F(i,j) then RV:=RV,[i,j] ; end if ;
end do ; end do ;
return RV ;
end proc ;


The problem is to do this inline, i.e. you have to write
(i,j)-> ...

 

please help...

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