More ways to calculate Phi in JS