puzzle contents
Contents
raw puzzle

Original Problem

My daughter was given the following task: given the first number x and the second number y, find the nth number. The description was quite vague, but my daughter managed to do the task.

Can you?

Example

Turns out, for x = 7, y = 10 and n = 5,
the output should be
nthPlace(x, y, n) = 19.

Input/Output

Solution

The solution is simply \(n-1\) times the difference of the upper and lower bound plus the lower bound:

\[s = x + (y - x) \cdot (n - 1)\]

Or as a JavaScript solution:

nthPlace = (x, y, n) =>
   x + (y - x) * --n