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:

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.
This is pretty neat. Now that I've given it a better look over, I think I get what's going on. I look forward to seeing your analysis!
I'm hoping to make some pretty radial graphs of the cycle-structures, and make a good spreadsheet of the m,i,j parameters, and the length of the lead-in, the length of the cycle, and the total length of the sequence until the first repeated value to see if I come up with any patterns.

But it would be awesome to see if any of you guys play with it and produce anything interesting.

Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

»
» All times are UTC - 5 Hours

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum