# 数喷泉

17

``````1, 1, 2, 3, 5, 9, 15, 26, 45, 78
``````

quintopia 2015年

@quintopia它应该工作的所有`n`，最多的数据类型，硬件等的限制
isaacg

3

## Python，57个字节

``f=lambda n,i=0:sum(f(n-j,j)for j in range(1,i+2)[:n])or 1``

Pyth中的17个字节：`M|sgL-Gd<ShHG1gQ0`
isaacg 2015年

5

# Mathematica，59个字节

``````SeriesCoefficient[1-Fold[1-x^#2/#&,Range[#,0,-1]],{x,0,#}]&
``````

@flawr序列的生成函数为`1/(1-x/(1-x^2/(1-x^3/(1-x^4/(1-x^5/(...))))))`
alephalpha

3

# 哈斯克尔， 60 48字节

``````n#p|p>n=0|p<n=sum\$map((n-p)#)[1..p+1]|1<2=1
(#1)
``````

``````t n p|p>n=0|p==n=1|p<n=sum[t (n-q) q|q<-[1..p+1]]
s n=t n 1
``````

nimi

nimi

3

``````n%i=sum[(n-j)%j|j<-take n[1..i+1]]+0^n
(%0)``````

``````n%i=sum[(n-j)%j|j<-[1..min(i+1)n]]+0^n
(%0)``````

1

# Matlab，115 105字节

``````function F=t(n,varargin);p=1;if nargin>1;p=varargin{1};end;F=p==n;if p<n;for q=1:p+1;F=F+t(n-p,q);end;end
``````

``````function F=t(n,varargin);
p=1;
if nargin>1
p=varargin{1};
end;
F=p==n;
if p<n;
for q=1:p+1;
F=F+t(n-p,q);
end;
end;
``````

1

# 朱莉娅，44 43字节

``f(a,b=1)=a>b?sum(i->f(a-b,i),1:b+1):1(a==b)``

``````function f(a, b=1)
if a > b
# Sum of recursing
sum(i -> f(a-b, i), 1:b+1)
else
# Convert bool to integer
1 * (a == b)
end
end``````

0

# Python 3，88个字节

``````f=lambda n,p:sum([f(n-p,q)for q in range(1,p+2)])if p<n else int(p==n)
t=lambda n:f(n,1)
``````

0

# JavaScript（ES6），63

``F=(n,p=1,t=0,q=0)=>p<n?eval("for(;q++<=p;)t+=F(n-p,q)"):p>n?0:1``