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:
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Find number of solutions of a linear equation of n variables
- Program to find number of solutions in Quadratic Equation
- Number of integral solutions of the equation x1 + x2 +.... + xN = k
- Number of non-negative integral solutions of sum equation
- Number of integral solutions for equation x = b*(sumofdigits(x)^a)+c
- Number of solutions for the equation x + y + z <= n
- Python | Finding Solutions of a Polynomial Equation
- Find 'N' number of solutions with the given inequality equations
- 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
- Find the integral roots of a given Cubic equation
- Find the equation of plane which passes through two points and parallel to a given axis
- Count number of solutions of x^2 = 1 (mod p) in given range
- Program to find equation of a plane passing through 3 points
- Find initial integral solution of Linear Diophantine equation if finite solution exists
- Program to find the Roots of Quadratic equation
- Find an integral solution of the non-linear equation 2X + 5Y = N
- Number of non-negative integral solutions of a + b + c = n
- Number of solutions to Modular Equations
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.