OFFSET
0,4
COMMENTS
All partitions with at most two parts automatically satisfy the condition; the restriction applies only from the third part onward. Sequence is nondecreasing.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..500
FORMULA
a(n) = number of distinct partitions lambda of n such that lambda_i <= lambda_{i-1} + lambda_{i-2} for all i >= 3.
EXAMPLE
For n = 6, the distinct partitions are (6), (1,5), (2,4), (1,2,3). All satisfy lambda_3 <= lambda_2 + lambda_1, so a(6) = 4.
For n = 7, the distinct partitions are (7), (1,6), (2,5), (3,4), (1,2,4); the last partition is disallowed because 4 > 2 + 1. Thus a(7) = 4.
MAPLE
b:= proc(n, x, y, i) option remember; `if`(n=0, 1,
`if`(i>n or i>x+y, 0, b(n-i, y, i, i+1)+b(n, x, y, i+1)))
end:
a:= n-> b(n$3, 1):
seq(a(n), n=0..80); # Alois P. Heinz, Jan 04 2026
MATHEMATICA
goodQ[p_] := And @@ Table[p[[i]] <= p[[i-1]] + p[[i-2]], {i, 3, Length[p]}];
a[n_] := Length @ Select[IntegerPartitions[n, All, All, True], goodQ];
Table[a[n], {n, 0, 50}]
PROG
(Python)
def partitions_distinct(n, max_part):
if n == 0:
yield ()
return
if max_part == 0 or n < 0:
return
if max_part <= n:
for p in partitions_distinct(n-max_part, max_part-1):
yield p + (max_part, )
yield from partitions_distinct(n, max_part-1)
def good(p):
return all(p[i] <= p[i-1] + p[i-2] for i in range(2, len(p)))
def a(n):
if n == 0:
return 1
return sum(1 for p in partitions_distinct(n, n) if good(p))
print([a(n) for n in range(0, 51)])
CROSSREFS
KEYWORD
nonn
AUTHOR
James Morgan, Dec 05 2025
STATUS
approved
