23 lines
345 B
Python
Executable File
23 lines
345 B
Python
Executable File
def pascal(n):
|
|
if n==1:
|
|
return [1]
|
|
else:
|
|
r=pascal(n-1)
|
|
x=[0]+r
|
|
y=r+[0]
|
|
return [i+j for i,j in zip(x,y)]
|
|
|
|
def nats(n):
|
|
yield n
|
|
yield from nats(n+1)
|
|
|
|
def primo(s):
|
|
n=next(s)
|
|
yield n
|
|
yield from primo(i for i in s if i%n!=0)
|
|
|
|
s=nats(1)
|
|
print(pascal(next(s)))
|
|
p=primo(nats(2))
|
|
|