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):
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?

I have the APR or APY of each project, and want to calculate the accrued interest from APR, and convert to APY to compare. So, how would the APR calculation differ? Everything I've found for APY that does not have contributions factored in still gives $A=P(1+r/n)^{n/r}$
– ZeroPhase Apr 04 '22 at 16:09