https://practice.geeksforgeeks.org/problems/arithmetic-number/0

class Solution {
public:
  int inSequence(int A, int B, int C) {
    // B = A + (n - 1)C
    // (B - A) / C + 1 = n;
    return (B == A + ((B - A) / C) * C);
  }
};