login
A320382
Number of partitions of n into distinct parts such that the successive differences of consecutive parts are nonincreasing.
9
1, 1, 1, 2, 2, 3, 4, 4, 5, 7, 7, 8, 10, 10, 12, 16, 14, 16, 20, 20, 23, 27, 26, 29, 35, 34, 38, 44, 43, 48, 55, 53, 59, 68, 67, 74, 83, 79, 88, 100, 98, 106, 118, 117, 127, 142, 139, 149, 164, 165, 179, 192, 191, 206, 226, 224, 240, 260, 257, 277, 301, 299, 319, 344, 346
OFFSET
0,4
COMMENTS
Partitions into distinct parts (p(1), p(2), ..., p(m)) such that p(k-1) - p(k-2) >= p(k) - p(k-1) for all k >= 3.
LINKS
Fausto A. C. Cariboni, Table of n, a(n) for n = 0..1000 (terms 0..100 from Seiichi Manyama)
EXAMPLE
There are a(17) = 16 such partitions of 17:
01: [17]
02: [1, 16]
03: [2, 15]
04: [3, 14]
05: [4, 13]
06: [5, 12]
07: [6, 11]
08: [7, 10]
09: [1, 6, 10]
10: [8, 9]
11: [1, 7, 9]
12: [2, 6, 9]
13: [2, 7, 8]
14: [3, 6, 8]
15: [4, 6, 7]
16: [2, 4, 5, 6]
There are a(18) = 20 such partitions of 18:
01: [18]
02: [1, 17]
03: [2, 16]
04: [3, 15]
05: [4, 14]
06: [5, 13]
07: [6, 12]
08: [7, 11]
09: [1, 6, 11]
10: [8, 10]
11: [1, 7, 10]
12: [2, 6, 10]
13: [1, 8, 9]
14: [2, 7, 9]
15: [3, 6, 9]
16: [3, 7, 8]
17: [4, 6, 8]
18: [5, 6, 7]
19: [1, 4, 6, 7]
20: [3, 4, 5, 6]
PROG
(Ruby)
def partition(n, min, max)
return [[]] if n == 0
[max, n].min.downto(min).flat_map{|i| partition(n - i, min, i - 1).map{|rest| [i, *rest]}}
end
def f(n)
return 1 if n == 0
cnt = 0
partition(n, 1, n).each{|ary|
ary0 = (1..ary.size - 1).map{|i| ary[i - 1] - ary[i]}
cnt += 1 if ary0.sort == ary0
}
cnt
end
def A320382(n)
(0..n).map{|i| f(i)}
end
p A320382(50)
CROSSREFS
Sequence in context: A097920 A029042 A320470 * A259200 A153155 A225085
KEYWORD
nonn
AUTHOR
Seiichi Manyama, Oct 12 2018
STATUS
approved