If there is an array that contains random integers in ascending order, how can I tell if this array contains a arithmetic sequence (length>3) with the common differece x?

Example:
**Input:** Array=[1,2,4,5,8,10,17,19,20,23,30,36,40,50]
x=10
**Output:** True

Explanation of the Example: the array contains [10,20,30,40,50], which is a arithmetic sequence (length=5) with the common differece 10.

Thanks!

I apologize that I have not try any code to solve this since I have no clue yet.

After reading the answers, I tried it in python.
Here are my codes:

```py
df = [1,10,11,20,21,30,40]
i=0
common_differene=10
df_len=len(df)
for position_1 in range(df_len):
    for position_2 in range(df_len):
        if df[position_1] + common_differene == df[position_2]:
            position_1=position_2
            i=i+1
print(i)

```

However, it returns 9 instead of 4.

Is there anyway to prevent the repetitive counting in one sequence [10,20,30,40] and also prevent accumulating i from other sequences [1,11,21]?