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:
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Find number of solutions of a linear equation of n variables
- Program to find number of solutions in Quadratic Equation
- 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
- Python | Finding Solutions of a Polynomial Equation
- Find 'N' number of solutions with the given inequality equations
- Number of solutions of n = x + n ⊕ x
- Number of solutions for x < y, where a <= x <= b and c <= y <= d and x, y are integers
- Number of solutions to Modular Equations
- Count number of solutions of x^2 = 1 (mod p) in given range
- Number of non-negative integral solutions of a + b + c = n
- Find the missing value from the given equation a + b = c
- Find the quadratic equation from the given roots
- Find count of numbers from 0 to n which satisfies the given equation for a value K
- Program to find the Roots of Quadratic equation
- Find the integral roots of a given Cubic equation
- Program to find equation of a plane passing through 3 points
- Find the equation of plane which passes through two points and parallel to a given axis
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.