- #1

- 153

- 3

Given the following series of functions

f(a) = b (step 1)

f(b) = c (step 2)

f(c) = d (step 3)

...

f(n) = a (step n)

Is there a general way to rework these so that you can directly calculate the value at steps 1,2,3 etc rather than having to iterate through all the steps from a to x, something like this?

f(0) = a

f(1) = b

f(2) = c

f(3) = d

...

f(n) = a

This problem arose from a computer program I'm working on and it would be much more efficient to directly calculate the n'th term rather than having to iterate through them all.

Thanks for any help