How many distinct trapezoidal
decompositions (sum of consecutive
positive integers) does n have?
For example, 15 = 7+8 = 4+5+6 =
1+2+3+4+5 has three.
I did not find a closed form formula, but was able to generate the information programmatically. I focused on how many consecutive integers were in each trapezoidal decomposition.
Look at 15: it has decompositions of lengths 2, 3, and 5.
For a given decomposition length L, the integers which have trapezoidal decomposition lengths L follow these rules:
the smallest such n is the L-th triangular number, ie L(L+1)/2
and also all larger integers which are 0 mod L (for odd L) or L/2 mod L (for even L)
The program makes a dictionary where the keys are the possible values of n with at least one trapezoidal decomposition. The value for each key is a list of possible numbers of addends forming a valid decomposition.
The length of each list is the desired number.
Results for n <= 45:
3 [2] (length of list is 1, so 3 has 1 way)
5 [2]
6 [3]
7 [2]
9 [2, 3]
10 [4]
11 [2]
12 [3]
13 [2]
14 [4]
15 [2, 3, 5]
17 [2]
18 [3, 4]
19 [2]
20 [5]
21 [2, 3, 6]
22 [4]
23 [2]
24 [3]
25 [2, 5]
26 [4]
27 [2, 3, 6]
28 [7]
29 [2]
30 [3, 4, 5]
31 [2]
33 [2, 3, 6]
34 [4]
35 [2, 5, 7]
36 [3, 8]
37 [2]
38 [4]
39 [2, 3, 6]
40 [5]
42 [3, 4, 7]
44 [8]
45 [3, 5, 6, 9]
-----------
myDict = {}
otherDict = {}
for series_length in range(2,20):
for smallest in range(1,20):
alist = [smallest + k for k in range(series_length)]
the_sum = sum(alist)
if series_length not in otherDict:
otherDict[series_length] = [the_sum]
else:
otherDict[series_length].append(the_sum)
if the_sum not in myDict:
myDict[the_sum] = [series_length]
else:
myDict[the_sum].append(series_length)
# for ln in sorted(otherDict.keys()):
# print(ln, otherDict[ln])
for sm in sorted(myDict.keys()):
print(sm, myDict[sm])
|
Posted by Larry
on 2025-02-03 10:39:28 |