
Christopher D. answered 12/28/18
Computer Programmer and Educator
I'm not sure what "f" is in step 3 of your algorithm. It looks like a function when you write "...f ( p0)...", but it looks like a variable when you write ".../f". Otherwise, this is pretty easy to write using a for loop (or while loop), and an if statement.