# Ring Chain Generation by Counting

Hello I was looking at the list of available chaining methods and there doesn’t seem to be an in-house way of generating new rings by changing how the indexing is counted. Say you had the ring look like this (0,1,2,3,4,5,6,7), and wanted to count index places by twos, you’d modify it with .count(2n) to get the new chain (0,2,4,6). Or you could alter your starting point by using the sequence (2n+1) to get the new chain (1,3,5,7). What the command is saying is count by 2 index places, and start at index place 1. The new ring values stop generating after it loops for simplicity. Here’s are a two more examples of counting by different amounts.
(0,1,2,3,4,5,6,7).count(5n) -> (0,5,2,7,4,1,6,3)
(0,1,2,3,4,5,6,7)count(11n-2) -> (0,3,6,1,4,7,2,5)

If there is a way to do this then could someone please help me? If this type of chaining method isn’t possible yet, would this be a good place to post this as a suggested feature? Currently I’m using a program I made on my graphing calculator to manually generate these rings, and then type the new ring into the computer.

One possible way to achieve the above might be to extend `rotate` - something like:

``````(0,1,2,3,4,5,6,7).rotate(0, index_mult: 5)
(0,1,2,3,4,5,6,7).rotate(-2, index_mult: 11)
``````

(The above imagines an implementation where the rotation would be limited to occurring in a linear (the existing) fashion, (if you left out the `index_mult` opt for example) or a geometric fashion (by adding an `index_mult` value in). It wouldn’t handle rotating by other amounts such as an exponential value).

I can’t think of a nice simple way to make a `rotate` function that is more generic or flexible than the above…
Maybe @samaaron might have other comments?

1 Like