Given three non-negative integers a, d and x. Here, a is the first element, d is the difference of an AP (Arithmetic Progression). We need to find if x is part of given AP or not.
Input : a = 1, d = 3, x = 7 Output : Yes 7 is part of given AP, 1 + 3 + 3 = 7 Input : a = 10, d = 0, x = 10 Output : Yes
Firstly, in case d = 0, we should output Yes if a = x else answer is No. For non-zero d, if x belongs to sequence x = a + n * d where n is non-negative integer, only if (n – a) / c is non-negative integer.
- Split the number into N parts such that difference between the smallest and the largest part is minimum
- Partiton N into M parts such that difference between Max and Min part is smallest
- Number of ways to split a binary number such that every part is divisible by 2
- Minimize sum of adjacent difference with removal of one element from array
- Largest subset where absolute difference of any two element is a power of 2
- Number of possible permutations when absolute difference between number of elements to the right and left are given
- Find N integers with given difference between product and sum
- Find the element that appears once
- Program to find the percentage of difference between two numbers
- Find the minimum difference between Shifted tables of two numbers
- Find an index such that difference between product of elements before and after it is minimum
- Program to find the maximum difference between the index of any two different numbers
- Find the Kth position element of the given sequence
- Find First element in AP which is multiple of given prime
- Find the maximum element in the array other than Ai
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : jit_t