import math


def arctan_z_term(z, term_index):
    """
    Generates each term in Gregory-Leibniz series for arctan(z)
    
    """
    term_power = (term_index*2+1)  # Each term is raised to this power, and also divided by this value
    
    return (math.pow(z, term_power)/term_power)*((-1)**(term_index))