Q:

Use python to compute long sequence

Guys i'm trying to solve this equation using python

What we need to find is a value N for which that equation give a result of 2.718.  
What i did until now, having problems with decimals, is this:
import math
from decimal import Decimal
import scipy.misc

limit = 2.718
ris = 0
n = 1
while ris <= limit:
   ris = Decimal(n / math.pow(scipy.misc.factorial(n), 1/n))
   n= n + 1

   print(n,ris)

The main problem is that in a certain point it start just to print Zeros and i don't know if it is still computing but not showing anymore the results or it has crashed. 
Any idea to fix this? 

A:

This solution is using the power operator ** which is a bit faster than pow because it don't have the overhead of a function load and call. 
import math
from decimal import Decimal

limit = Decimal(2.718)

result = 0
n = Decimal(1)
one = Decimal(1)
n_factor = Decimal(n)

while result <= limit:
    result = n / Decimal(n_factor ** (one/n))
    n += 1
    n_factor *= n
    # print (n, result) # uncomment to see intermediate results

print ('Final', n, result)

note: it's not optimal, but at least it will calculate the N
note #2: see comments below for explanations about the problems regarding 'scipy' and Zeros

A:

Interesting answers from Tim Rijavec and syntonym.  Here's some further thought. 
As syntonym suggested, the problem is, for n = 171 scipy.misc.factorial returns array(inf).  It is because when you invoke this function without additional parameters it returns a float.  You could set it so that it returns the exact integer value:
>>> scipy.misc.factorial(171)
array(inf)
>>> scipy.misc.factorial(171, exact = True)
1241018070217667823424840524103103992616605577501693185388951803611996075221691752992751978120487585576464959501670387052809889858690710767331242032218484364310473577889968548278290754541561964852153468318044293239598173696899657235903947616152278558180061176365108428800000000000000000000000000000000000000000
>>> 

So if you rewrite the program thusly, you wouldn't get an error:
from decimal import Decimal
import scipy.misc

limit = Decimal(2.718)

ris = 0
n = 1
one = Decimal(1)

while ris <= limit:
   ris = n / Decimal(scipy.misc.factorial(n, exact= True) ** (one/n))
   n= n + 1

   print(n,ris)

But for some reason, it is inefficient and takes quite some time to finish.  In situations like this you might wanna ease up on the condition:
while abs(ris - limit) > 0.025:
   ris = n / Decimal(scipy.misc.factorial(n, exact= True) ** (one/n))
   n= n + 1

