If u is the ancestor of v then u is the LCA of u and v Now check if weigh [ v ] is prime or not
if ( v == u ) : NEW_LINE INDENT if ( prime [ weight [ v ] ] ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT return count NEW_LINE DEDENT