[ad_1]

I’d like to preface this with the fact that I’m noobish at coding. My problem is that I’d like to generate a new value of a sequence with a function inside the recursive formula (in python). The sequence is given by

this formula and I defined the neccesary function in the picture p by:

```
import math
def p (k, q):
if math.gcd(k, q) == q:
return 1
elif math.gcd(k, q) == 1:
return q
else:
return alpha
```

, and “alpha” in the code block above is just some integer that’s produced in earlier part of the whole program. Now, my question is how could I produce for a given an integer n, its corresponding value given by the formula where the first three values of the sequence are k_1 = 1, k_2 = 2, and k_3 = 6.

Thank you in advance!

[ad_2]