[Question]
  [
This was inspired by a math problem I saw somewhere on the internet but do not remember where (UPDATE: The original problem was found on [the math riddles subreddit](https://www.reddit.com/r/mathriddles/comments/2v6eaj/doubling_and_adding_1/) with a proof provided that it is possible, also see [this Math SE post](https://math.stackexchange.com/a/2767139/558915)), asking for a proof if the following process is possible for any arbitrary pair of integers (from what I remember, it was possible for any given pair):
Given a pair of integers, j and k, double one of them and add one to the other, resulting in a pair of new integers, i.e., (j, k) -> (j+1, k\*2) or (j\*2, k+1). Then repeat this process with those integers, with the objective of having the pair of integers be equal.
These given examples are not necessarily optimal but show how this process can be done on any integers, positive, negative or zero:
```
(2, 5) -> (3, 10) -> (6, 11) -> (12, 12)
(5, 6) -> (6, 12) -> (7, 24) -> (14, 25) -> (28, 26) -> (56, 27) -> (112, 28) -> (113, 56) -> (226, 57) -> (227, 114) -> (228, 228)
(0, 2) -> (1, 4) -> (2, 5) -> (3, 10) -> (6, 11) -> (12, 12)
(-4, 0) -> (-3, 0) -> (-2, 0) -> (-1, 0) -> (0, 0)
(3, -1) -> (6, 0) -> (12, 1) -> (13, 2) -> (14, 4) -> (15, 8) -> (16, 16)
(-4, -3) -> (-8, -2) -> (-16, -1) -> (-32, 0) -> (-31, 0) -> ... -> (0, 0)
```
## Challenge
Create a program that given two integers, outputs the list of steps required to make those integers equal by repeatedly incrementing one and doubling the other
## Specifications
* The solution does not have to be optimal but it must solve in a finite number of steps for any arbitrary pair
* Input must be two integers
* Output may be any reasonable output that clearly denotes the resulting integers of each step, for example:
	+ a string with two distinct delimiters (any symbol, whitespace, etc), one for each integer in a pair and one for each pair
		- e.g., input j, k: 2, 5 -> output: 3,10;6,11;12,12
	+ a list of lists of integers
		- e.g. input j, k: 2, 5 -> output: [[3, 10], [6, 11], [12, 12]]
* If the input is a pair of equal numbers, you may output anything as long as it's consistent with other nontrivial answers
	+ for example
		- if input [2, 5] has output [[3, 10], [6, 11], [12, 12]], which does not include the input pair, then input [4, 4] should output nothing.
		- if input [2, 5] has output [[2, 5], [3, 10], [6, 11], [12, 12]], which does include the input pair, then input [4, 4] should output [[4, 4]].
* Standard IO methods apply and standard loopholes banned
* This is code golf so shortest answer in bytes wins
  
[Answer]
# JavaScript (ES6), ~~111~~ ~~90~~ 83 bytes
```
f=(a,b,p=q=[],u=[...p,[a,b]])=>a-b?f(...(q=[[a*2,b+1,u],[a+1,b*2,u],...q]).pop()):u
```
[Try it online!](https://tio.run/##bcpBDsIgEAXQvadgOaMDaal1YYIehLCAWoymKdSK18fZmrqaP@//p//4dXg98lvO6TbWGg14CpTNYqyjYqxSKpNlcw7NxctwjcAG3Fu/1xQOLRXHC76Bf85cLw5VThkQz6UOaV7TNKop3SGCJtEj7n6xJ3HaYENCb1AeSTQb7UjI9u9Wdoj1Cw "JavaScript (Node.js) – Try It Online")
### Commented
```
f = (                       // f = recursive function taking:
  a, b,                     //   (a, b) = input integers
  p =                       //   p[] = current path
  q = [],                   //   q[] = queue
  u = [...p, [a, b]]        //   u[] = updated path with [a, b] appended to it
) =>                        //
  a - b ?                   // if a is not yet equal to b:
    f(...                   //   recursive call, using spread syntax:
      (q = [                //     prepend the next 2 possible moves in the queue:
        [a * 2, b + 1, u],  //       a * 2, b + 1
        [a + 1, b * 2, u],  //       a + 1, b * 2
        ...q                //
      ]).pop()              //     use the move on the top of the queue
    )                       //   end of recursive call
  :                         // else:
    u                       //   success: return the (updated) path
```
[Answer]
## Haskell, ~~70~~ 69 bytes
```
f(w@((i,j):_):r)|i==j=w|1<2=f$r++[(i+1,j*2):w,(i*2,j+1):w]
g x=f[[x]]
```
[Try it online!](https://tio.run/##JYc9DsIgFIB3T8Hg8F55mEKtA5HEC3gCQgyDrWDbNGhCh94dSVy@n5f/vJ/TVMoA@QYQKKJ@oE64B2Oiybu8KjMcE@cWApcUG4U6E4RGUeSytjuMbDODtZtzZfZhYYbNfr0zWFNYvqcRmQVFPRL0dKlsSVWKM7VVHQn5P9GhKz8 "Haskell – Try It Online")
A simple BFS. Keeps track of the steps in a list of list of pairs.
```
g x=f[[x]]                -- start with a single list where the only
                          -- step is the starting pair
f (w@((i,j):_):r) =       -- let w be the first list of steps
                          --     (i,j) the last pair of the first list of steps
                                       ('last' as in last operated on. As we store
                                        the steps in reverse order it's the
                                        first element in the list)
                          --     r all other lists of steps
   i==j=w                 -- if i==j stop and return the first list
   1<2= f                 -- else make a recursive call
          r++             -- where the new input list is r followed by
                          -- the first list extended one time by
          [(i+1,j*2):w,         (i+1,j*2) and one time by
             (i*2,j+1):w]       (i*2,j+1)
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~90~~ ~~74~~ 72 bytes
-2 bytes thanks to [Dennis](https://codegolf.stackexchange.com/users/12012/dennis).
```
def f(a,*x):j,k=a[0];return(j==k)*a or f(*x,[(2*j,k+1)]+a,[(j+1,2*k)]+a)
```
[Try it online!](https://tio.run/##NY1NDoIwFIT3nmI2hL7yMAXEhQYvQlgQhVjQ0rQl0dNjWbiYzE@@ZOw3PBdTbfptFxfgv/4QdfRDcMN9dV4v5qXfOohaKUXbYxgxip7lhy4Tz03fqu7qhrA6I6ammUn2WFxE5IdbUcrIZAV1WR/blBVcynlvtI2RstAGomTUxBA147y7YpS75yeG2kPFyIv/kld0OQDWaRNEmnjkNyQ@RQJhOf62tiOi7Qc "Python 3 – Try It Online")
Takes input as a [singleton list](https://codegolf.meta.stackexchange.com/a/11884/64121).
---
## Ungolfed
```
def f(a,*x):              # function taking at least one argument
                          # a is the first argument, all other are stored in x
  j, k = a[0]             # get the newest values of the current path
  return (j==k)*a         # if j is equal to k return the current path
                  or      # else ...
   f(                     # continue ...
     *x,                  # with the remaining paths ...
     [(2*j,k+1)]+a        # and split the current path ...
     [(j+1,2*k)]+a        # in two new ones
    ) 
```
[Answer]
# Pyth, 41 bytes
```
J]]QL,hhb*2ebWt{KehJ=J+tJm+hJ]d,yK_y_K)hJ
```
[Try it here](http://pyth.herokuapp.com/?code=J%5D%5DQL%2Chhb%2A2ebWt%7BKehJ%3DJ%2BtJm%2BhJ%5Dd%2CyK_y_K%29hJ&input=%5B2%2C%205%5D&debug=0)
### Explanation
This is pretty straightforward breadth-first search. Keep a queue of possible sequences (`J`), and until we get a matching pair, take the next sequence, stick on each of the possible moves, and put them at the end of the queue.  
For the sake of brevity, we define a function `y` (using the lambda expression `L`) to perform one of the moves, and apply it both forward and in reverse.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes
```
ḃ2d2;@+*¥\
0çṪEɗ1#Ḣç
```
[Try it online!](https://tio.run/##y0rNyan8///hjmajFCNrB22tQ0tjuAwOL3@4c5XryemGyg93LDq8/P/hdsNjS9wfNa3JetS479C2Q9v@/4820lEwjdVRiDbVUTAD0QY6CkYgWtdER8EAxDDWUdA1hInoGscCAA "Jelly – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~25~~ ~~22~~ 20 bytes
Takes a doubly nested list as input and outputs a jagged list with each step at one nest-depth.
```
[ć¤Ë#¤xs>R‚ø`R‚s¸sâ«
```
[Try it online!](https://tio.run/##MzBNTDJM/f8/@kj7oSWHu5UPLakotgt61DDr8I4EEFV8aEfx4UWHVgNVREcb6ZjGxsYCAA "05AB1E – Try It Online")
**Explanation**
```
[                      # start a loop
 ć                     # extract the first element of the current list (current path)
  ¤Ë#                  # break if all elements in the head are equal
     ¤xs>              # duplicate one copy of the head and increment another
         R             # reverse the incremented copy
          ‚ø           # zip them together
            `R‚        # reverse the tail of the zipped list
               s¸sâ    # cartesian product with the rest of the current path
                   «   # append to the list of all current paths
```
[Answer]
# [Retina](https://github.com/m-ender/retina/wiki/The-Language), 72 bytes
```
\d+
*
/\b(_+),\1\b/^+%`(_+),(_+)$
$&;_$&$2¶$=;$1$&_
G`\b(_+),\1\b
_+
$.&
```
[Try it online!](https://tio.run/##K0otycxLNPyvquGe8D8mRZtLi0s/JkkjXltTJ8YwJkk/Tls1AcwDESpcKmrW8SpqKkaHtqnYWqsYqqjFc7knIKnnitfmUtFT@//fSMeUy1THDAA "Retina – Try It Online") Only two test cases due to the limitations of unary arithmetic. Explanation:
```
\d+
*
```
Convert to unary.
```
/\b(_+),\1\b/^+
```
While the input does not contain a pair of identical numbers...
```
%`(_+),(_+)%
```
...match the last pair on each line...
```
$&;_$&$2¶$=;$1$&_
```
...and turn the line into two lines, one suffixed with the first number incremented and second doubled, the other suffixed with the first number doubled and second incremented.
```
G`\b(_+),\1\b
```
Keep the line with the matching pair.
```
_+
$.&
```
Convert back to decimal. ~~89~~ 88-byte unsigned decimal arithmetic version (works with 0 as well):
```
/\b(\d+),\1\b/^+%`(\d+),(\d+)$
$&;$.(_$1*),$.(2*$2*)¶$=;$.(2*$1*),$.(_$2*
G`\b(\d+),\1\b
```
[Try it online!](https://tio.run/##K0otycxLNPyvquGe8F8/JkkjJkVbUyfGMCZJP05bNQHCBZMqXCpq1ip6GvEqhlqaOkCGkZaKkZbmoW0qttYQHlQ8HijM5Z6AbNb//0Y6plymOmZcBjpGAA "Retina – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), 24 bytes
```
`vxG1r/q:"tt1rEk(+]td0=~
```
Running time is random, but it is finite with probability 1.
The code is very inefficient. Inputs requiring more than 4 or 5 steps have a large probability of timing out in the online interpreter.
[**Try it online!**](https://tio.run/##y00syfn/P6Gswt2wSL/QSqmkxLDINVtDO7YkxcC27v//aAMFo1gA)
### Explanation
```
`         % Do...while
  vx      %   Concatenate stack and delete. This clears the stack from contents
          %   of previous iterations   
  G       %   Push input
  1       %   Push 1
  r       %   Push random number uniformly distributed on (0,1)
  /       %   Divide
  q       %   Subtract 1. The result is a random number, t, that has nonzero
          %   probability of being arbitrarily large. Specifically, t is in
          %   the interval (0,1) with probability 1/2; in (1,2) with probability
          %   1/6; ... in (k,k+1) with probability 1/((k+1)*(k+2).
  :       %   Range [1 2 ... floor(t)]
  "       %   For each (that is: do thw following floor(t) times)
    tt    %     Duplicate twice
    1     %     Push 1
    rEk   %     Random number in (0,1), times 2, round down. This produces a 
          %     number i that equals 0 or 1 with probability 1/2
    (     %     Write 1 at entry i. So if the top of the stack is [a b], this
          %     transforms it into either [1 b] or [a 1]
    +     %     Add, element-wise. This gives either [a+1 2*b] or [2*a b+1] 
  ]       %   End for each
  td      %   Duplicate, consecutive difference between the two entries
  0=~     %   Is it not zero? If so, the do...while loop continues with a new
          %   iteration. Normally the code 0=~ could be omitted, because a
          %   nonzero consecutive difference is truthy. But for large t the
          %   numbers a, b may have gone to infinity, and then the consecutive
          %   difference gives NaN
          % End do...while (implicit). Display (implicit)
```
[Answer]
# [Stax](https://github.com/tomtheisen/stax), ~~29~~ 26 [bytes](https://github.com/tomtheisen/stax/blob/master/docs/packed.md#packed-stax)
```
ä⌠|Tô&cm♂NV↓↔╗╣¢♠╜╒█¡Φ≈ñY@
```
[Run and debug it](https://staxlang.xyz/#p=84f47c549326636d0b4e56191dbbb99b06bdd5dbade8f7a45940&i=[[1+3]]%0A[[-1+-2]]&a=1&m=2)
It's a breadth first search. It seems reasonably fast. 
It takes a doubly-array-wrapped pair of integers. The output is a space separated list of values. Every two values represents one pair in the path to the solution.
[Answer]
# [Haskell](https://www.haskell.org/), 95 bytes
```
g s|a:_<-[a|a@((x,y):_)<-s,x==y]=a
g s=g$do a@((x,y):_)<-s;[(x*2,y+1):a,(x+1,y*2):a]
h t=g[[t]]
```
[Try it online!](https://tio.run/##VcqxCoMwEIDh3ae4weGi56DQDqkHvkcIctCSSK2WJkMCvnt07fbD93sJ79e6luIgHKLnsTNyyISYKCs9q7ELlJizZamuhV393OHfHwZTM1Bue6WFMLU95Wa42lYeIjtjorXlI8sGDN/fskWoweON7qqc "Haskell – Try It Online") Outputs in reverse order, e.g. `h(2,5)` yields `[(12,12),(6,11),(3,10),(2,5)]`.
[Answer]
# [Red](http://www.red-lang.org), 142 bytes
Takes the input as a doubly nested block of the pair of integers in [Red](http://www.red-lang.org)'s format `(2, 5)` -> `2x5` 
Returns the result as a list ot [Red](http://www.red-lang.org) pairs, for example `2x5 3x10 6x11 12x12`. Includes the initial pair.
```
func[c][a: copy[]foreach d c[l: last d if l/1 = l/2[return d]do replace/all{%+ 1x0 * 1x2
%* 2x1 + 0x1}"%""append/only a append copy d l "]f a]
```
[Try it online!](https://tio.run/##XY29CoMwAIR3n@IIuCiiibWD0JfoGjKE/FAhJCFViJQ@u7XtUOxy3Hccd8no7Wo0F4UdN7t4xZXgcoQKceXChmSkukFDcTfCyfu8@8nCtRSXXRlPZl6ShxY6IJnopDKtdO5R1qC5Q7UrK8oKLFPU6DJ9kpIQGaPxug3erZD40udzn3cgwkKKLabJz7DgnOVBiOLHQz4fuMvswM0pd4egzw39bzT9IWHvje0F "Red – Try It Online")
## Strict input:
The input is two numbers, for example `2 5`
# [Red](http://www.red-lang.org), 214 bytes
```
func[a b][g: func[c][a: copy[]foreach d c[l: last d if l/1 = l/2[return d]append/only a append copy d l + 1x0 * 1x2
append/only a append copy d l * 2x1 + 0x1]g a]c: copy[]insert/only c reduce[do rejoin[a 'x b]]g c]
```
[Try it online!](https://tio.run/##fY/NCsIwEITvfYq5CZViE38OBV/Ca8ghbhKthKTEFurT16XF6snL8g27M@xkZ6eLs0oXvpn8EEkZXLW6NZgFaWUaUOpeSvuUnaE7LEiFBsE8e@bWI@wEzjylyq4fcoTVputctLsUwwsGi5pj2BGwhRhrlDxl8f@yhBwF39ej0DcYTZ9n2vh0uV9shOzsQE7ZxPRIbeQSm5F7sIf01OU29vCQOBYfPuK0cg25cnVAvYo9KvG7qfbFN0tObw "Red – Try It Online")
## Explanation:
```
f: func[a b][                 
g: func[c][                                   ; recursive helper function
  a: copy[]                                   ; an empty block
  foreach d c[                                ; for each block of the input 
    l: last d                                 ; take the last pair
    if l/1 = l/2[return d]                    ; if the numbers are equal, return the block 
    append/only a append copy d l + 1x0 * 1x2 ; in place of each block append two blocks
    append/only a append copy d l * 2x1 + 0x1 ; (j+1, k*2) and (j*2, k+1)
  ]                                           ; using Red's arithmetic on pairs
  g a                                         ; calls the function anew
]
c: copy[]insert/only c reduce[do rejoin[a 'x b]]; prepares a nested block from the input
g c                                           ; calls the recursive function 
]
```
]