Composite Number Sum Error
New to sage, although familiar with a few other coding langages. Trying to obtain a sum of alternating terms. Any idea on this one? Thanks in advance.
def a(n) : return [k for k in (1..n) if not is_prime(k)] from mpmath import * mp.dps = 15 mp.pretty = True nsum(lambda n: (1)/(a(n)), [1,5000], method='alternating')
TypeError: unable to coerce <type 'sage.libs.mpmath.ext_main.mpf'> to an integer