I need to find a better way to raise the 'tes' variable in python till I can get the print out to terminate. (Running rather slow at 700)
I propose the need for a better way of defining the 'shifts' list, and reducing redundancies since the problem is symmetric lcm(shifts(n,m))=lcm(shift(mxn))
N, M, k =3,3,0
tes =700
sides=[]
def gcd(n, m):
if m == 0:
return n
return gcd(m, n % m)
for N in range(tes+1):
M=3
for M in range(tes+1):
n, m, shifts = N, M, []
while ma.floor(min (n,m)/2)>= 1:
shifts.append(2*n+2*m-4)
n-=2
m-=2
#lcm of shifts list
lcm = 1
for i in shifts:
lcm = lcm * i // gcd(lcm, i)
p = ma.log(lcm) / ma.log(3)
# checking to see if power lcm is in {3^d} where d in Natural numbers
if (p - int(p) == 0) and lcm>1:
print(shifts, N, M,lcm)
M+= 1
N+ 1
So far I have attempted to come up with an equation to make composing the list more efficient (so far this pythonic manner seems to be working better). Was working with sympy but that became to cumbersome dealing with sympy.products to try and directly find the lcm of the list flat out because I couldn't get the bounds correct.
-If I could find a way to avoid redundancies, since lcm is the same f(m,n)=f(n,m).
-Need list comprehension for the shifts if not a basic formula
-Been Looking into mathematical ways to prove if the two sets (3^d,lcm(shifts)) intersect for some natural numbers, but I need to transform lcm(shifts(n,m)) into an analytic function from the current programmatic/numerical method.
-Any resources are also helpful, because this is just a segment for the total project and any further reading I'm sure will be a help in the future for the overall project.