Additive Sequence Generators
by Warren Burt

An additive sequence is one in which a rule is applied for adding seed values. This rule is then repeated again and again, making an infinitely long series of numbers.

The most familiar additive sequence is the Fibonacci Sequence. The rule is that each element in the sequence is the sum of the two elements before it. Starting with the seed 1,1, the beginning of the sequence looks like this:

1 1 2 3 5 8 13 21 34 55 89 144 233 377 610.....

Notice how each element of the sequence is the sum of the two elements before it. For example 144 = 89 + 55, 610 = 377 + 233, etc.

The rule for this sequence can be written as

A[n] = A[n-2] + A[n-1]

(Each number is the sum of the number 2 elements before it and the number 1 element before it. The [n] or [n–2] etc. indicates the position of the element in the sequence.)

If you use the seed 1, 1 with this rule, you get the classic Fibonacci series. If you use the seed 2, 1 with this rule, you get a series known as the Lucas numbers.

This package of additive sequence generators for ArtWonk allows you to have access to the following sequence rules.

A[n] = A[n-2] + A[n-1]

B[n] = B[n-3] + B[n-1]

C[n] = C[n-3] + C[n-2]

D[n] = D[n-4] + D[n-1]

E[n] = E[n-4] + E[n-3]

F[n] = F[n-5] + F[n-1]

G[n] = G[n-5] + G[n-2]

H[n] = H[n-5] + H[n-3]

I[n] = I[n-5] + I[n-4]

J[n] = J[n-6] + J[n-1]

K[n] = K[n-6] + K[n-5]

(Other rules can be made by going into the function modules and changing the equation. For example, to get the rule K[n] = K[n-6] + K[n-4], simply change the line in the function: G.((A+B) Mod In(9)) to G.((A+C) Mod In(9)), etc.)

The Functions are named after these sequence names and their element places. So, for example, “AddSqA21" is the function to use for rule A: A[n] = A[n-2] + A[n-1], while “AddSqH53" is the function to use for rule H, etc.

The patch "Additive Sequence Functions Demo.awp" shows how these functions work, and give you the choice to switch between two different functions, and change the starting values for each.

Inputs:

Strb: Input for strobe to get the next element in the sequence.

Reset: Input for strobe to reset the sequence to the values in the seeds inputs. If the values in the seeds inputs are unchanged, the function will reset to the beginning, but if the values are changed, the sequence will restart with the new values as seeds. You can even set up two (or more!) of these functions in a feedback loop, where the output of one becomes the seeds for the second, which becomes the seeds for the third, etc. This makes the additive sequence counter a very powerful interactive tool.

Seed 1, 2, n: Inputs for the Seeds for the sequence. Each sequence has a different length seed, depending on how many elements back in the series the addition takes place. That is, “AddSqJ61" (rule J[n] = J[n-6] + J[n-1]) has a 6 element long seed, while rule A only has 2 seeds. Any values may be placed in these inputs, but small integers make the most easily observable sequences.

MOD: Input for Modulo input. To make the sequences manageable, this allows you to count the sequence modulo N, that is, when the value of the sequence reaches a certain limit, set by MOD, you do a modulo division on the sequence from that point on. See below for ideas on how to use the MOD input.

Outputs:

Out 1, 2, n: The output of the chosen sequence, n elements back. That is, Out 1 gives the output of the sequence 1 element back, Out 2 gives the output of the sequence 2 elements back, Out 6 gives the output of the sequence 6 elements back, etc. Since these are in a "bucket-brigade" delay line kind of structure, it means that you can use 2 or more different outputs canonically.

Notes on the Seed Inputs:

Although simple seeds like 1, 1 (for A) or 1, 0, 0, 0, 0, 1 (for K) will produce simple sequences which start at low values, it should be emphasized that you can use ANY numbers for these inputs. Explore!

Note also that a strobe at the Reset input will restart the sequence with the values currently at the seed inputs. So that sequences which leap about, sequences which restart, sequences which interact with each other, etc. are all possible.

Notes on the MOD Input:

Again, you can use any value you like for the MOD input. Setting the MOD input to a very high value, like 5000, allows you to see the beginning of each sequence unchanged for quite a while. Setting the MOD to a low value, like 12, gives you repeating sequences or varying lengths.

For the seed 1, 1, the chart below gives the length of sequences you’ll get for MOD settings from 1 to 24, and 60 and 61. However, AddSeqC32 produced different length sequences - with seeds 3,1,2, MOD 3, it produced a 13 element repeating sequence, MOD 4 produced a 14 element sequence, MOD 5 produced a 4 element sequence and MOD 6 produced a 91 element repeating sequence. So clearly, there is much exploration to be done here, to see what combinations of Seeds, Rules, and MOD values produce sequences which are of interest to you. Further, the use of an external IMOD function can also produce interesting results. For example, let's say you want to have values from 0-18. Setting AddSeqA21 to Mod 19 with seeds 1,1 will produce a sequence of 18 elements. But a setting of MOD 60 will produce a sequence of 120 elements. Taking this output and then dividing it MOD 19 will produce a sequence of 120 elements which will have the needed values from 0-18. Again, there's a lot of exploring to be done here. Have fun!

With AddSeqA21, for seeds 1, 1:

Modulo N

Seq. Length

1

0

2

0

3

8

4

6

5

20

6

24

7

16

8

12

9

24

10

60

11

10

12

24

13

28

14

48

15

40

16

24

17

36

18

24

19

18

20

60

21

16

22

30

23

48

24

24

60

120

61

60