def attractor153_graph(n, p, multiple=3, b=10):
 G = DiGraph()
 for k in range(1, (n + 1)):
  if (((k % multiple) == 0) and (k not in G)):
   k1 = k
   knext = powersum(k1, p, b)
   while (k1 != knext):
    G.add_edge(k1, knext)
    k1 = knext
    knext = powersum(k1, p, b)
 return G

def attractor153_graph ( n , p , multiple = 3 , b = 10 ) : G = DiGraph ( ) for k in range ( 1 , ( n + 1 ) ) : if ( ( ( k % multiple ) == 0 ) and ( k not in G ) ) : k1 = k knext = powersum ( k1 , p , b ) while ( k1 != knext ) : G . add_edge ( k1 , knext ) k1 = knext knext = powersum ( k1 , p , b ) return G
return digraph of iterations of powersum .