1 int n;
2 cin>>n;
3 int a=0,b=0,c=1;
4 if (n < 3) return 0;
5 cout<<a<<" "<<b<<" "<<c<<" ";
6 for(int i = 1; i<= n-3; i++){
7 int d = a + b + c;
8 cout<<d<<" ";
9 a = b;
10 b = c;
11 c = d;
12 }
1def trib_iter(m):
2 lista=[m]
3 c=0
4 d=True
5 while d==True:
6 novalista=[]
7 for n in lista:
8 if n in [0,1,2]:
9 c+=1
10 else:
11 for i in range(1,4):
12 if n-i in [0,1,2]:
13 c+=1
14 else:
15 if n-i<0:
16 pass
17 else:
18 novalista.append(n-i)
19 if novalista==[]:
20 d=False
21 else:
22 lista=novalista
23 return c
24