+ 1
What is logic fr this
15,29,56,108,,208,400..
3 Antworten
+ 22
//real question is here
https://www.sololearn.com/Discuss/1025358/?ref=app
+ 4
#This one will be like this according to oeis.org
#http://oeis.org/A000078
print("Recursive")
def tet(x):
if x == 0 or x == 1 or x == 2:
return 0
elif x == 3:
return 1
else:
return tet(x-1)+tet(x-2)+tet(x-3)+tet(x-4)
for i in range(20):
print(tet(i),end=" ")
print("\nList loop")
tetra = [0,0,0,1]
for i in range(4,20):
tetra.append(tetra[i-1]+tetra[i-2]+tetra[i-3]+tetra[i-4])
print(tetra)
0
May I ask where did you get these series?