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: 
[APL (Dyalog Unicode)](https://www.dyalog.com/), ~~24 23~~ 22 bytes
===================================================================

```apl
{∨/×⍺|⍵+⍳⍴⍺:⍺∇⍵+1⋄⍵}∘1

```

[Try it online!](https://tio.run/##SyzI0U2pTMzJT///qG@qp/@jtgkG/9OAZPWjjhX6h6c/6t1V86h3q/aj3s2POhcBeVZA/KijHSRm@Ki7BUjXPuqYYfj/f5qCsYKJgilXmoIpkDYG0kZAEVMFcyDLRMFSwQgobAlkGxoqmAOFjRWMAA "APL (Dyalog Unicode) – Try It Online")

Technically, this is a tacit function. I had to make it so since the only input allowed is the list of integers. Uses `⎕IO←0` (0-indexing)

It's worth noting that the function times out if `n` doesn't exist.

Thanks to @ngn and @H.PWiz for 1 byte each.

### How?

```apl
{∨/×⍺|⍵+⍳≢⍺:⍺∇⍵+1⋄⍵}∘1 ⍝ Main function. ⍺=input; ⍵=1.
{                   }∘1 ⍝ Using 1 as right argument and input as left argument:
           :            ⍝ If
        ⍳≢⍺             ⍝ The range [0..length(⍺)]
      ⍵+                ⍝ +⍵ (this generates the vector ⍵+0, ⍵+1,..., ⍵+length(⍺))
    ⍺|                  ⍝ Modulo ⍺
   ×                    ⍝ Signum; returns 1 for positive integers, ¯1 for negative and 0 for 0.
 ∨/                     ⍝ Logical OR reduction. Yields falsy iff the elements of the previous vector are all falsy.
            ⍺∇⍵+1       ⍝ Call the function recursively with ⍵+1.
                 ⋄⍵     ⍝ Else return ⍵.

```
[Jelly](https://github.com/DennisMitchell/jelly), 10 bytes
==========================================================

```
1Ḷ+$ọ¥Ạ¥1#

```

[Try it online!](https://tio.run/##ASUA2v9qZWxsef//MeG4tisk4buNwqXhuqDCpTEj////WzUsIDQsIDNd "Jelly – Try It Online")