A real recursion

Problem 517

For every real number is given the sequence by:
for
for

.
Find for prime and
Give your answer modulo 1000000007.