How to calculate APY from APR?

36 Views Asked by At

I'm trying to figure out how some investments based on compounding interest with bi-weekly contributions compare. One lists the APY, and the other lists the APR. I'm writing a program for comparing multiple interest rates, and want to make sure my math is right.

For calculating accrued from APY is this right? (I divide the r by n, and multiply n by r to take into account periods of more than once a year):

enter image description here

How would the formula differ for APR? Do I just need to recursively call $P(1+r/n)^{nr}$, with the $P$ updated each term?