0

I'm want to build a game (with steps) that the solution have a Recurrence relation, i.e. - to solve the game you have to move from point A to point B, from point B to point C...(kind of a maze).

Of course that will be a few ways to each point, and the player should choose the way with the amount of the steps by the Recurrence relation...

What I need?
I need few Recurrence relations (something like 4) that all the first 15 elements (it can be less the 15) are between $3-50$

I try to find few, but there was problems:
$x(n)= 2*x(n-1)$ - if I choose $x(0)>0$ the numbers are getting higher too much fast...
$x(n)=2*x(n-1)-x(n-2)$ - Too much easy to solve (from few examples...).
(I took those examples from a site...)

Can you help me and give me few examples?

Thank you!

CS1
  • 2,047
  • 1
    Perhaps you might try using modular arithmetic to force numbers to fall into a specific range. For example, using $x_n = 2x_{n-1}\mod{30}$ with $x_0 = 3$ you get the sequence $3,6,12,24,18,6,12,24,18,6,\dots$ (18 instead of 48 because 18=48-30). – JMoravitz May 24 '15 at 21:59
  • Thank you @JMoravitz!! If you have more ideas like that it will be great!! :-). And if it can be with no-repeat it will be better! Thank you so much!! :-) – CS1 May 24 '15 at 22:08
  • 2
    Consider prime modules and primitive roots $a$, $x_n=ax_{n-1}\pmod{p}$ for no-repeat. – Alexey Burdin May 24 '15 at 22:12
  • 1
    To expand on what Alexey suggests, by taking different seed values for $x_0$ and $a$, interesting patterns can occur. For example, with $x_0=1$, $a=2$, and $p=13$, the same recursive definition generates the sequence: $1,2,4,8,3,6,12,11,9,5,10,7,1,2,4,8,\dots$. You might become more adventurous by using non-linear recursive definitions (e.g.by taking the square of the previous number) or by using more than just the previous number (like fibonacci $f_n = f_{n-1} + f_{n-2}$), etc. Whatever you use though can always be forced into a specific range by considering modular arithmetic is my point. – JMoravitz May 24 '15 at 22:19

1 Answers1

1

This python script tests relations in the form $x_{n+1}=ax_n+bn+c$.
An example: 1 -1 8 3 [3, 9, 14, 18, 21, 23, 24, 24, 23, 21, 18, 14, 9, 3] $x_n=x_{n-1}-n+8,\ x_1=3$ yields the above sequence (in bracets).
Or this 1 1 -5 11 [11, 8, 6, 5, 5, 6, 8, 11, 15, 20, 26, 33, 41, 50]