Given three integers A, B and C, the task is to find the count of values of X such that the following condition is satisfied,
X = B * Sm(X)A + C where Sm(X) denotes the sum of digits of X and 1 < X < 109.
Input: A = 3, B = 2, C = 8
For X = 10, 2 * (1)3 + 8 = 10
For X = 2008, 2 * (10)3 + 8 = 2008
For X = 13726, 2 * (19)3 + 8 = 13726
Input: A = 2, B = 3, C = 10
Approach: An important observation can be made here that the sum of digits can be atmost 81 (i.e. X = 999999999) and corresponding to each sum of digits, we get a single value of X. So we can iterate through each sum of digit and check if the resulting value of X is valid or not.
Below is the implementation of the above approach:
- Program to find number of solutions in Quadratic Equation
- Find number of solutions of a linear equation of n variables
- Number of solutions for the equation x + y + z <= n
- Number of integral solutions of the equation x1 + x2 +.... + xN = k
- Number of integral solutions for equation x = b*(sumofdigits(x)^a)+c
- Number of non-negative integral solutions of sum equation
- Find 'N' number of solutions with the given inequality equations
- Find the missing value from the given equation a + b = c
- Number of solutions for x < y, where a <= x <= b and c <= y <= d and x, y are integers
- Number of solutions of n = x + n ⊕ x
- Find the quadratic equation from the given roots
- Count number of solutions of x^2 = 1 (mod p) in given range
- Number of solutions to Modular Equations
- Number of non-negative integral solutions of a + b + c = n
- Program to find the Roots of Quadratic equation
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. 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.