I need to check if number is a period of sequence.

EXAMPLE: { 1, 3, 1, 4, 2, 1, 3, 1, 4, 2, 1, 3 }

Periods are 5 and 10. Base period is 5 because it is the smallest period.

```
#include <iostream>
#include <vector>
int p=0;
int period(std::vector<double>v , int x)
{
    int p = 0;
    for (int i = 1; !p && i < v.size(); i++)
    {
        int j = 0;
        while (j < v.size() - i && v[j] == v[j + i]) ++j;
        if ( j + i == v.size() ) p = i;
    }
    if(p!=x)
    return false;
    return true;
}

int main()
{
    std::vector<double> v = { 1, 3, 1, 4, 2, 1, 3, 1, 4, 2, 1, 3 };
    std::cout << period( v,10 ) << '\n';
}

```

My code checks if number is equal to base period. How could I check if it is equal to any of the periods and in that case return true?