Construct the sequence arr, arr, ... by the following rules. For i=1 we put arr=1. Now let i >= 2. Then arr[i] is the least positive integer such that the following two conditions hold
(i) arr[i] > arr[i - 1];
(ii) for all k, j < i we have arr[i] is not equal to n1 * arr[k] - n2 * arr[j].
Find the first n terms of this sequence.
Input:n1 = 2, n2= 1, n = 10Output:1 2 4 5 10 11 13 14 28 29Explanation:The first 10 terms of the sequence is printed.
Input:n1 = 1, n2= 1, n = 5Output:1 2 3 4 5Explanation:The first 5 terms of the sequence is printed.
You don't need to read input or print anything. Your task is to complete the function findSeq() which takes 3 Integers n1, n2, and n as input and returns a vector denoting the first n terms of the sequence.
Expected Time Complexity: O(n2) Expected Auxiliary Space: O(n2)