Let's first define 3 parameters (m,i,j) and one variable (n).

As an example, we'll set i=10,j=1, and vary m over it's full cycle modulo i^j (in this case that means 0≤m<10).

Next, we generate a sequence by iterating n in the following expression until it becomes cyclical.

With our example values, we get the following:

Now, in full generality (for the first 10 diagonals of 2-tuples):

I have about 38MB of data for analysis from running this, lets see what you guys come up with.

As an example, we'll set i=10,j=1, and vary m over it's full cycle modulo i^j (in this case that means 0≤m<10).

Next, we generate a sequence by iterating n in the following expression until it becomes cyclical.

With our example values, we get the following:

**Code:**```
```

0: 1; 0 (this yields a lead-in of length 1 and a cycle of length 1)

1: 1 (this leads a cycle of length 1)

2: 1; 2, 4, 6, 8, ... (this yields a lead-in of length 1, and a cycle of length 4)

3: 1, 3, 9, 7, ... (this yields a cycle of length 4)

4: 1; 4, 6, ... (lead-in of length 1, and cycle of length 2)

5: 1; 5, ... (lead-in of length 1, and cycle of length of length 1)

6: 1; 6, ... (lead-in of length 1 and cycle of length 0)

7: 1, 7, 9, 3, ... (this yields a cycle of length 4)

8: 1; 8, 4, 2, 6, ... (this yields a lead-in of length 1, and a cycle of length 4)

9: 1, 9, ... (this yields a cycle of length 2)

Now, in full generality (for the first 10 diagonals of 2-tuples):

**Code:**```
#!/usr/bin/env python
```

from math import sqrt

def inv_tri(t):

return 0.5*(sqrt(8*t+1)-1)

def tri(n):

return n*(n+1)/2

dct = {}

props = {}

for i in range(tri(11)):

it = inv_tri(i)

first = int(it)

second = i - tri(first)

pair = (first - second, second)

base,exponent = pair

modulus = base**exponent

if modulus: print pair

for j in range(modulus):

id = (j, base, exponent)

num = 1

dct[id] = []

while num not in dct[id]:

dct[id].append(num)

num = (num*j) % modulus

run_up = dct[id].index(num)

total = len(dct[id])

cycle = total - run_up

props[id] = (run_up,cycle,total)

print "\t%d (of %d)" % (j, modulus)

print "\t", dct[id]

print "\t", props[id]

print ""

I have about 38MB of data for analysis from running this, lets see what you guys come up with.