# [seqfan] Re: Number of ways to write n^2 as the sum of n odd numbers

Richard Mathar mathar at strw.leidenuniv.nl
Fri Sep 25 20:44:12 CEST 2009

```dr> Date: Fri, 25 Sep 2009 12:11:17 -0500
dr> To: Sequence Fanatics Discussion list <seqfan at list.seqfan.eu>
dr> Subject: [seqfan]  Number of ways to write n^2 as the sum of n odd numbers
dr>
dr> Greetings Sequence Fans,
dr>
dr> Everybody knows that the nth square is equal to the sum of the first n
dr> odd numbers.
dr> It might be interesting to calculate the number of ways to write n^2
dr> as the sum of n
dr> odd numbers, disregarding order.
dr>
dr> For example, 9 can be written as a sum of three odd numbers in 3 ways: 1+1+7,
dr> 1+3+5, and 3+3+3.
dr>...

An even more fundamental question is whether the table of the number
of partitions of n into k odd parts is in the OEIS. There are many ways
to write such a table. The row sums are A00009, and the table would start
with rows n>=1 and columns 1<=k<=n as

1
0   1
0   0   1
0   1   0   1
0   0   1   0   1
0   1   0   1   0   1
0   0   2   0   1   0   1
0   1   0   2   0   1   0   1
0   0   2   0   2   0   1   0   1
0   1   0   3   0   2   0   1   0   1
0   0   3   0   3   0   2   0   1   0   1
0   1   0   4   0   3   0   2   0   1   0   1
0   0   3   0   5   0   3   0   2   0   1   0   1
0   1   0   5   0   5   0   3   0   2   0   1   0   1
0   0   4   0   6   0   5   0   3   0   2   0   1   0   1
0   1   0   7   0   7   0   5   0   3   0   2   0   1   0   1
0   0   4   0   9   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0   8   0  10   0   7   0   5   0   3   0   2   0   1   0   1
0   0   5   0  11   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  10   0  13   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   5   0  15   0  14   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  12   0  18   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   6   0  18   0  20   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  14   0  23   0  21   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   6   0  23   0  26   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  16   0  30   0  28   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   7   0  27   0  35   0  29   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  19   0  37   0  38   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   7   0  34   0  44   0  40   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  21   0  47   0  49   0  41   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   8   0  39   0  58   0  52   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  24   0  57   0  65   0  54   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   8   0  47   0  71   0  70   0  55   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  27   0  70   0  82   0  73   0  56   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   9   0  54   0  90   0  89   0  75   0  56   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   1   0  30   0  84   0 105   0  94   0  76   0  56   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0   3   0   2   0   1   0   1
0   0   9   0  64   0 110   0 116   0  97   0  77   0  56   0  42   0  30   0  22   0  15   0  11   0   7   0   5   0

To eliminate the regular zeros, one would write it as triangle for the
odd n=1,3,5,... and odd k=1,3,5,...n (row sums A035294):

1
0   1
0   1   1
0   2   1   1
0   2   2   1   1
0   3   3   2   1   1
0   3   5   3   2   1   1
0   4   6   5   3   2   1   1
0   4   9   7   5   3   2   1   1
0   5  11  11   7   5   3   2   1   1
0   5  15  14  11   7   5   3   2   1   1
0   6  18  20  15  11   7   5   3   2   1   1
0   6  23  26  22  15  11   7   5   3   2   1   1
0   7  27  35  29  22  15  11   7   5   3   2   1   1
0   7  34  44  40  30  22  15  11   7   5   3   2   1   1
0   8  39  58  52  42  30  22  15  11   7   5   3   2   1   1
0   8  47  71  70  55  42  30  22  15  11   7   5   3   2   1   1
0   9  54  90  89  75  56  42  30  22  15  11   7   5   3   2   1   1
0   9  64 110 116  97  77  56  42  30  22  15  11   7   5   3   2   1   1
0  10  72 136 146 128 100  77  56  42  30  22  15  11   7   5   3   2   1   1

.. David's version is reading this version along a parabolic line n=k^2....

and another embedded triangle for the even n=2,4,6,8,.. and even k=2,4,6,..,n,
row sums A078408:

1
1   1
1   1   1
1   2   1   1
1   3   2   1   1
1   4   3   2   1   1
1   5   5   3   2   1   1
1   7   7   5   3   2   1   1
1   8  10   7   5   3   2   1   1
1  10  13  11   7   5   3   2   1   1
1  12  18  15  11   7   5   3   2   1   1
1  14  23  21  15  11   7   5   3   2   1   1
1  16  30  28  22  15  11   7   5   3   2   1   1
1  19  37  38  30  22  15  11   7   5   3   2   1   1
1  21  47  49  41  30  22  15  11   7   5   3   2   1   1
1  24  57  65  54  42  30  22  15  11   7   5   3   2   1   1
1  27  70  82  73  56  42  30  22  15  11   7   5   3   2   1   1
1  30  84 105  94  76  56  42  30  22  15  11   7   5   3   2   1   1
1  33 101 131 123  99  77  56  42  30  22  15  11   7   5   3   2   1   1
1  37 119 164 157 131 101  77  56  42  30  22  15  11   7   5   3   2   1   1

It seems in both sub-triangles, reading columns downwards "converges"
to A000041.

Richard J. Mathar

```