4
$\begingroup$

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,...

$\endgroup$
2
  • $\begingroup$ What's the source of this puzzle? $\endgroup$ Commented Jun 12, 2018 at 18:28
  • 1
    $\begingroup$ @NathanHinchey No source, just created it myself. $\endgroup$
    – O0123
    Commented Jun 13, 2018 at 6:05

2 Answers 2

2
$\begingroup$

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.

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

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|$.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.