Recursion and changing variables

I am using a recursive function to plot some points on a graph.
For example:

def loop(x, c, limit):
    x1 = pow(x,2)
    #plot x1 as a coordinate
    if limit > 0:
        loop(x1, limit - 1)

loop(x, 5) #x would be some chosen starting point on the graph

This would create a bunch of points that exponentially grow for 5 iterations. For example. If I want to know at which point on the graph 5 iterations would take the x point beyond 10,000 (or something) and color the dots (including the original dot!) a different color how would I do that? So like if x = 5, 5 would reach past 10k on the 5th iteration. So then ALL the x dots on this loop would be colored differently since starting at five would break 10k.

I try different things but only dots that actually go over 10k end up getting colored differently.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.