02-06-2020, 10:02 PM

This simple program can generate a vast number of integer sequences, many relating to graph theory, combinatorics and theoretical physics. For a list of named sequences, see the CROSSREFS section of A172455. The theory behind the program is explained in this paper.

To use the program, level 2 should have a list of 3 integers on level 2, as explained in the two above links. Level 1 should have an integer indicating the number of terms to be returned in the output list. The program should be run in exact mode due to the sizes of the numbers involved.

For additional entertainment, look at the description of A167872.

To use the program, level 2 should have a list of 3 integers on level 2, as explained in the two above links. Level 1 should have an integer indicating the number of terms to be returned in the output list. The program should be run in exact mode due to the sizes of the numbers involved.

Code:

\<< SWAP EVAL \-> n a1 a2 a3

\<< { 1 } 2 n

FOR k DUPDUP REVLIST * 0 + \GSLIST a3 *

OVER k 1 - GET k a1 * a2 + * + +

NEXT

\>>

\>>

For additional entertainment, look at the description of A167872.