Question: Sometimes to fall asleep, I'll count as high as I can, whilst skipping numbers that are not [square-free](https://en.wikipedia.org/wiki/Square-free_integer). I get a little thrill when I get to skip over several numbers in a row - for example, `48,49,50` are all NOT square-free (48 is divisible by 2^2, 49 by 7^2, and 50 by 5^2).

This led me to wondering about the earliest example of adjacent numbers divisible by some arbitrary sequence of divisors.

Input
-----

Input is an ordered list `a = [a_0, a_1, ...]` of strictly positive integers containing at least 1 element.

Output
------

Output is the smallest positive integer `n` with the property that `a_0` divides `n`, `a_1` divides `n+1`, and more generally `a_k` divides `n+k`. If no such `n` exists, the function/program's behavior is not defined.

Test Cases
----------

```
[15] -> 15
[3,4,5] -> 3
[5,4,3] -> 55
[2,3,5,7] -> 158
[4,9,25,49] -> 29348
[11,7,5,3,2] -> 1518

```

Scoring
-------

This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"); shortest result (per language) wins bragging rights. The usual loopholes are excluded.

Answer: 
JavaScript, ~~42~~ 40 bytes
===========================

Will throw a recursion error if there is no solution (or the solution is too big).

```js
a=>(g=y=>a.some(x=>y++%x)?g(++n):n)(n=1)

```

Saved 2 bytes with a pointer from [Rick Hitchcock](https://codegolf.stackexchange.com/users/42260/rick-hitchcock)

---

Try it
------

Enter a comma separated list of numbers.

```js
o.innerText=(f=
a=>(g=y=>a.some(x=>y++%x)?g(++n):n)(n=1)
)(i.value=[5,4,3]);oninput=_=>o.innerText=f(i.value.split`,`.map(eval))
```

```html
<input id=i><pre id=o>
```
[Ruby](https://www.ruby-lang.org/), ~~47 46 43~~ 42 bytes
=========================================================

```ruby
->a{(1..).find{|i|a.all?{|v|i%v<1&&i+=1}}}

```

[Try it online!](https://tio.run/##XcxLCsIwFIXhuasoFYviNXBzE2rA6kJqBxENBIoU@wBJsvYYigPr@PvPeY23dzTVNR7O2iHrh0fHjH3enbdeM922F@cnbzfTCYvC7isMIcRuHPosXztT1wQCZNOEbEu7fPUDMgHNIOVSOBBIKGdDeVyiAAU8bdXMXJH4CxChTHMC/j3AFMQP "Ruby – Try It Online")

NB: the `(1..)` syntax is only supported in ruby 2.6, for the moment TIO only supports 2.5 so the link is to an older version (43 bytes).