# What are the rules here?

If you follow our rules, and you start with 1 and 5 then it goes into

1, 5, 1, 3, 1, 1, 1,...

If you follow our rules, and you start with 14 and 2 then it goes into

14, 2, 10, 2, 6, 2, 2, 2,...

If you follow our rules, and you start with 2 and 14 then it goes into

2, 14, 2, 10, 2, 6, 2, 2, 2,...

If you follow our rules, and you start with 9 and 3 then it goes into

9, 3, 3, 3, 3,...

If you follow our rules, and you start with 26 and 61 then it goes into

26, 61, 26, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 0, 0,...

• What's the source of this puzzle? Jun 12, 2018 at 18:28
• @NathanHinchey No source, just created it myself. Jun 13, 2018 at 6:05

## 2 Answers

A minor refinement on athin's answer to account for the last sequence:

Denote the last two numbers in the sequence are $A$ and $B$ (initially there are only two numbers).

If $A < B$, append $A$ to the sequence;
else, append the greater of $A-2B$ and 0.

• But, for $1 1$, it should be $1$ not $0$ on the first sequence. Jun 12, 2018 at 0:25
• Good point! My answer does not account for all of them! Jun 12, 2018 at 18:27

It's possible that the rule is:

Denote the last two numbers in the sequence are $A$ and $B$ (initially there are only two numbers).

If $A < B$, append $A$ to the sequence;
else, append $|A-2B|$.

• In this case, the last sequence is wrong! Jun 11, 2018 at 13:25
• you need a second "if": if $A>2B$, append $|A-2B|$, else append $A - 2$ (or $B - 1$?). Jun 11, 2018 at 14:53
• Oh, and if $A=B$, append $A$ (or $B$). Jun 11, 2018 at 14:54
• Whoops I just realized this.. and uh tbh it's rather hacky to have 3 ifs btw :( Jun 12, 2018 at 0:22