Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I filter only integer solutions in sagemath?

import time
Start_Time = time.time()
var('x y N M D d F f G g L l Q q S s U u')

eq0 = N-1019 == 0 



eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

eq15 =u+1==0


eq16 = (N-3)/8+y*(y-1)/2-M == 0

eq17 = 2*x*(x+1)-M == 0 

solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,D,d,F,f,G,g,L,l,Q,q,S,s,U,u)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

How do I filter only integer solutions in sagemath?

import time Start_Time = time.time() var('x y N M D d F f G g L l Q q S s U u') u')

eq0 = N-1019 == 0 



eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

eq15 =u+1==0


eq16 = (N-3)/8+y*(y-1)/2-M == 0

eq17 = 2*x*(x+1)-M == 0 

solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,D,d,F,f,G,g,L,l,Q,q,S,s,U,u)
solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,F,f,G,g,L,l,Q,q,S,s,U,u)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

How do I filter only integer solutions in sagemath?

import time Start_Time = time.time() var('x y N M F f G g L l Q q S s U u')

eq0 = N-1019 == 0 



eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

eq15 =u+1==0


eq16 = (N-3)/8+y*(y-1)/2-M == 0

eq17 = 2*x*(x+1)-M == 0 

solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,F,f,G,g,L,l,Q,q,S,s,U,u)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

How do I filter only integer solutions in sagemath?

import time Start_Time = time.time() var('x y N M F f G g L l Q q S s U u')

eq0 = N-1019 == 0 



eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

eq15 =u+1==0


eq16 = (N-3)/8+y*(y-1)/2-M == 0

eq17 = 2*x*(x+1)-M == 0 

solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,F,f,G,g,L,l,Q,q,S,s,U,u)
sol = solutions  
Execution_Time = time.time() - Start_Time
print (Execution_Time)
print(sol)

How do I filter only integer solutions in sagemath?

import time Start_Time = time.time() var('x y N M F f G g L l Q q S s U u')

 eq0 = N-1019 == 0 



 eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
 eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
 eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
 eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
 eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
 eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
 eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
 eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
 eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
 eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
 eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
 eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

 eq15 =u+1==0


 eq16 = (N-3)/8+y*(y-1)/2-M == 0

 eq17 = 2*x*(x+1)-M == 0 

 solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,F,f,G,g,L,l,Q,q,S,s,U,u)
 sol = solutions  
 Execution_Time = time.time() - Start_Time
 print (Execution_Time)
 print(sol)

How do I filter only integer solutions in sagemath?

How do I filter only integer solutions in sagemath?

import time
 Start_Time = time.time()
 var('x y N M F f G g L l Q q S s U u')

u')
 eq0 = N-1019 == 0 



 eq3 = (32*((2*(3*3/4*M+1)-3*(-x)+1)/24)+3*(2*f-1)^2-3)/8-F==0
 eq4 = ((2*(3*3/4*M+1)-3*(-x)+1)/24)+3/4*M- F == 0
 eq5 = (32*((2*(3*F+1)-3*(f)+1)/24)+3*(2*g-1)^2-3)/8-G==0
 eq6 = ((2*(3*F+1)-3*(f)+1)/24)+3/4*M- G == 0
 eq7 = (32*((2*(3*G+1)-3*(g)+1)/24)+3*(2*l-1)^2-3)/8-L==0
 eq8 = ((2*(3*G+1)-3*(g)+1)/24)+3/4*M- L == 0
 eq9 = (32*((2*(3*L+1)-3*(l)+1)/24)+3*(2*q-1)^2-3)/8-Q==0
 eq10 = ((2*(3*L+1)-3*(l)+1)/24)+3/4*M- Q == 0
 eq11 = (32*((2*(3*Q+1)-3*(q)+1)/24)+3*(2*s-1)^2-3)/8-S==0
 eq12 = ((2*(3*Q+1)-3*(q)+1)/24)+3/4*M- S == 0
 eq13 = (32*((2*(3*S+1)-3*(s)+1)/24)+3*(2*u-1)^2-3)/8-U==0
 eq14 = ((2*(3*S+1)-3*(s)+1)/24)+3/4*M- U == 0

 eq15 =u+1==0


 eq16 = (N-3)/8+y*(y-1)/2-M == 0

 eq17 = 2*x*(x+1)-M == 0 

 solutions = solve([eq0,eq3,eq4,eq5,eq6,eq7,eq8,eq9,eq10,eq11,eq12,eq13,eq14,eq15,eq16,eq17],x,y,N,M,F,f,G,g,L,l,Q,q,S,s,U,u)
 sol = solutions  
 Execution_Time = time.time() - Start_Time
 print (Execution_Time)
 print(sol)