# n-th prime factor and handling equations with multiple variables at once

Hello! I was wondering how to get the n-th factor of a number in such a way that I can work with it easily(Without it being in parenthesis as an example). For example, the 5th factor of 36 and in Sage I want to do (nth factor of 36)^2. Also, how does one have sage run code involving multiple variables with something like this without having to manually run it for each value of lets say the variable "l"? For my code here:

```
x=2336
y=2
z=80000
w=10
s=(2*x-w)
t=x/w
l=0
m=0
def a(x, i):
return (floor(abs((y*x*(2*i+1)/(s*(2*i+2)-y*(x*(2*i+1))))))+l)
def a2(x, i):
return (floor(abs((y*x*(2*i+1)*a(x, i))/(s*(2*i+2)*(a(x, i)+1)- y*(x*(2*i+1)*a(x, i)))))-m)
def what_im_looking_forb(min_range, max_range):
for l in range(200):
for i in range(min_range, max_range):
if abs(s*(2*i+2)*(a(x, i)+1)*(a2(x, i)+1)-y*x*(2*i+1)*(a(x, i))*(a2(x, i)))<z and (a(x, i) in Primes())==True and (a2(x, i) in Primes())==True and ((2*i+1) in Primes())==True:
print l, (2*i+1), x*(2*i+1), x*(2*i+1)*(a(x, i)), x*(2*i+1)*(a(x, i))*a2(x, i), s*(2*i+2)*(a(x, i)+1)*(a2(x, i)+1)-y*x*(2*i+1)*(a(x, i))*a2(x, i), gcd(x*(2*i+1)*(a(x, i))*(a2(x, i))*y,s*(2*i+2)*(a(x, i)+1)*(a2(x, i)+1))
what_im_looking_for(t,t+20000)
```

I want it to run through t, t+20000 at l=0, and then go to t, t+20000 at l=1, all the way to l=200 without having to do each input from l=0 to l=200 on my own. Currently only loops on l=0 and not on multiple l values.

It's looks like you're using Sage based Python version 2.x which should be considered outdated. Please switch to a newer version of Sage based on Python 3.x

Try to replace

`for l in range(200)`

(which creates a local variable`l`

independent of the global variable`l`

) withI did and I got a Syntax Error of "can't assign function to call."(Had the line below on the same indentation position the l=12 was because it gave me an indentation error otherwise)

It's not

`12`

(twelve) but`l2`

(el-two).Ohhh, l2 and 12 look very similar in that code font so that explains why I interpreted it wrong. Its now looping but I have the same issue of it repeating the same outputs from l=0 like last time instead of it giving me different outputs for each l.