This task is a variation of the short story by Arthur C. Clarke.

(Solvers should be aware of the consequences of completing this task.)

In detail, to specify what is meant by a   “name”:

The integer 1 has 1 name     “1”.
The integer 2 has 2 names   “1+1”,   and   “2”.
The integer 3 has 3 names   “1+1+1”,   “2+1”,   and   “3”.
The integer 4 has 5 names   “1+1+1+1”,   “2+1+1”,   “2+2”,   “3+1”,   “4”.
The integer 5 has 7 names   “1+1+1+1+1”,   “2+1+1+1”,   “2+2+1”,   “3+1+1”,   “3+2”,   “4+1”,   “5”.


Task
Display the first 25 rows of a number triangle which begins:

                                      1
                                    1   1
                                  1   1   1 
                                1   2   1   1
                              1   2   2   1   1
                            1   3   3   2   1   1

Where row   



n


{\displaystyle n}

   corresponds to integer   



n


{\displaystyle n}

,   and each column   



C


{\displaystyle C}

   in row   



m


{\displaystyle m}

   from left to right corresponds to the number of names beginning with   



C


{\displaystyle C}

.

A function   



G
(
n
)


{\displaystyle G(n)}

   should return the sum of the   



n


{\displaystyle n}

-th   row.

Demonstrate this function by displaying:   



G
(
23
)


{\displaystyle G(23)}

,   



G
(
123
)


{\displaystyle G(123)}

,   



G
(
1234
)


{\displaystyle G(1234)}

,   and   



G
(
12345
)


{\displaystyle G(12345)}

.

Optionally note that the sum of the   



n


{\displaystyle n}

-th   row   



P
(
n
)


{\displaystyle P(n)}

   is the     integer partition function.

Demonstrate this is equivalent to   



G
(
n
)


{\displaystyle G(n)}

   by displaying:   



P
(
23
)


{\displaystyle P(23)}

,   



P
(
123
)


{\displaystyle P(123)}

,   



P
(
1234
)


{\displaystyle P(1234)}

,   and   



P
(
12345
)


{\displaystyle P(12345)}

.



Extra credit
If your environment is able, plot   



P
(
n
)


{\displaystyle P(n)}

   against   



n


{\displaystyle n}

   for   



n
=
1
…
999


{\displaystyle n=1\ldots 999}

.

Related tasks
 Partition function P


PrintArray(List([1 .. 25], n -> List([1 .. n], k -> NrPartitions(n, k))));
 
[ [    1 ],
  [    1,    1 ],
  [    1,    1,    1 ],
  [    1,    2,    1,    1 ],
  [    1,    2,    2,    1,    1 ],
  [    1,    3,    3,    2,    1,    1 ],
  [    1,    3,    4,    3,    2,    1,    1 ],
  [    1,    4,    5,    5,    3,    2,    1,    1 ],
  [    1,    4,    7,    6,    5,    3,    2,    1,    1 ],
  [    1,    5,    8,    9,    7,    5,    3,    2,    1,    1 ],
  [    1,    5,   10,   11,   10,    7,    5,    3,    2,    1,    1 ],
  [    1,    6,   12,   15,   13,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    6,   14,   18,   18,   14,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    7,   16,   23,   23,   20,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    7,   19,   27,   30,   26,   21,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    8,   21,   34,   37,   35,   28,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    8,   24,   39,   47,   44,   38,   29,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    9,   27,   47,   57,   58,   49,   40,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,    9,   30,   54,   70,   71,   65,   52,   41,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   10,   33,   64,   84,   90,   82,   70,   54,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   10,   37,   72,  101,  110,  105,   89,   73,   55,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   11,   40,   84,  119,  136,  131,  116,   94,   75,   56,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   11,   44,   94,  141,  163,  164,  146,  123,   97,   76,   56,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   12,   48,  108,  164,  199,  201,  186,  157,  128,   99,   77,   56,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ],
  [    1,   12,   52,  120,  192,  235,  248,  230,  201,  164,  131,  100,   77,   56,   42,   30,   22,   15,   11,    7,    5,    3,    2,    1,    1 ] ]
 
 
List([23, 123, 1234, 12345], NrPartitions);
 
[ 1255, 2552338241, 156978797223733228787865722354959930,
  69420357953926116819562977205209384460667673094671463620270321700806074195845953959951425306140971942519870679768681736 ]