function in main for computing branching factor