Let P(x) be a function that returns the product of digits of x. For example P(935) = 9*3*5 = 135. ↵
Now let us define another function P_repeat(x):↵
↵
~~~~~↵
int P_repeat(int x){↵
if(x < 10) return x↵
return P_repeat(P(x))↵
}↵
~~~~~↵
↵
For a value v, find the number of numbers x less than N such that P_repeat(x) = v.↵
↵
How would I make a transition between states in a digit DP for this problem?↵
↵
Please help, and thanks in advance!↵
↵
UPD: The bounds are N <= 10^13.↵
Now let us define another function P_repeat(x):↵
↵
~~~~~↵
int P_repeat(int x){↵
if(x < 10) return x↵
return P_repeat(P(x))↵
}↵
~~~~~↵
↵
For a value v, find the number of numbers x less than N such that P_repeat(x) = v.↵
↵
How would I make a transition between states in a digit DP for this problem?↵
↵
Please help, and thanks in advance!↵
↵
UPD: The bounds are N <= 10^13.↵