I'll be honest that I don't know if this is the right subforum. If it isn't feel free to correct. For some background information, I don't actually have formal training in math beyond arithmetic and I only found out that the sequence involved with my messing around is called the square pyramidal sequence after caving and asking someone two years ago.

So as the above sentence suggests, there's game (equations? formula? function?) I've pen-and-papered with myself for years that involves the square pyramidal sequence.

For example I take 3:

3 | 9 | 14

And on one side of the paper, I'd write:

3

.42

The other side would have the variable in particular and might look like for example.

1

1.5

The problems between these two would then go as follows:

9÷4.5=2

1÷(0.42)=2.38

The 2.38 is greater than 2, so I'd change the 3 to a 4 on the one side of the paper and have:

4

1.2

And the problems will go as:

16÷4.5=3.56

1÷1.2= 0.833.

There's other rules I throw in to the game that is effectively a sort of pen and paper numbers simulation, but for now, if anyone can see the pattern I go through with here, what's a shorthand way to put these (functions? Formulas? Equations?) into code to reduce human error in sorting out my answers?

I also apologize if I don't know whether to call these functions or formulas. Again, I don't have a lot of knowledge in math terminology.