Generate a Python program that has the following intention:

The intention of the program is to implement a recursive function called p1 that takes two arguments, a and b. The function returns the value of a if b is equal to 0, otherwise it calls itself with b and the remainder of a divided by b, and continues to do so until the value of b is 0.

In other words, the function performs a series of divisions of a by b until b is 0, and returns the final value of a when b is 0. If b is not equal to 0, the function continues to divide a by b recursively until b is 0.