def name(i,j,k,l,m,n):
J=[i,j,k,l,m]
for _ in [0]*n:
if (J[-1]+J[-2])%2 == 0:
J.append((J[-1]+J[-2])//2)
elif (J[-1]+J[-2]+J[-3])%3 == 0:
J.append((J[-1]+J[-2]+J[-3])//3)
elif (J[-1]+J[-2]+J[-3]+J[-4]+J[-5])%5 == 0:
J.append((J[-1]+J[-2]+J[-3]+J[-4]+J[-5])//5)
else:
J.append(((J[-1]+J[-2])*J[-1]) % J[-2])
if J[-2] == 0 or J[-2] == J[-1]:
if J[-1] == i:
J=J[0:-1]
J.append(k)
else:
break
return J
print(name(4,3,2,1,0,30))
To embed this project on your website, copy the following code and paste it into your website's HTML: