Does that mean factorisation such that factors are all in the range 1...9?Stephan van Hulst wrote:. . . given an integer K, returns a list of integers who's digit product is K. . . .
Ramsin Khoshaba wrote:I was trying to solve this problem. So I wrote the following code.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Please explain a bit more. What about 4 8 and 9? I think I have misunderstood what you said there.Winston Gutkowski wrote:. . . 3. If K is an exact power of a single digit, the answer will be either 0 or 1. . . .
Winston Gutkowski wrote:Indeed, if K has any prime factor > 9, the answer MUST be 0.
Campbell Ritchie wrote:
Please explain a bit more. What about 4 8 and 9? I think I have misunderstood what you said there.Winston Gutkowski wrote:. . . 3. If K is an exact power of a single digit, the answer will be either 0 or 1. . . .
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Piet Souris wrote:Nice problem, and Winston is right.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:say K = 12. Now, we have the combinations that I mentioned. [2, 2, 3], [2, 6], [3, 4] (for K = 2 ^50, I get 231 different combinations).
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Piet Souris wrote:@Ramsin
the formulas needed are those of the multinomial distribution. It boils down to: we have R red, G green, B blue and W white balls, how many different permutations are there?
Ramsin Khoshaba wrote:In the worst case (where A=1 and B=10^100) there are approximately 352 billion different combinations of 1-9 digits.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:And finally: it might be worth to first check B – A. If that is less than say 10 ^7, then away with all clever solutions: vive Brute Force!
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:
Piet Souris wrote:And finally: it might be worth to first check B – A. If that is less than say 10 ^7, then away with all clever solutions: vive Brute Force!
Ooof. I have to disagree here (and I may be wrong), but the requirements only ask us to find out how many combinations there are; not what they are
I'm sure Piet will correct me if I'm wrong; but to me this problem is much more about understanding the numbers of combinations involved rather than what they actually are.
Winston
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Well, I too have to disagree. I meant this: (for A and B close enough, and both in the long-range)
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ryan McGuire wrote:Is there any sort of statute of limitations on answer programming questions that is likely a homework assignment? On the one hand, I understand the concept of not doing someone's homework for them. On the other, it may be fun to share some code that implements the entire solution.
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Now, that is pretty easy, I think, but that problem was also marked as 'moderate'. So, is OP's problem also that easy to solve? Hmmm...
Anyone with a brillliant easy solution?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Ramsin Khoshaba wrote:We have then, ...
x + 2*y + 3*z = 5
where x denotes the number of groups of size 1,
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Winston Gutkowski wrote:The longest number possible from K (not including '1's) ... blah blah blah...
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:Since my replies were hardly answered or commented, I guess there is not much interest for it.
Ramsin Khoshaba wrote:Now for each such permutation there should belong a 3 also. So we get,
Or, 56 such permutations.
Ramsin Khoshaba wrote:
Piet Souris wrote:Since my replies were hardly answered or commented, I guess there is not much interest for it.
I think that is because everyone is really absorbed in its own thoughts, so it gets difficult to change your "perspective" when you've been thinking a lot from another one.
Ramsin Khoshaba wrote:Second, the problem is not so easy maybe.
Piet Souris wrote:Well, I'm not sure I understand, but I wish you success!
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Piet Souris wrote:@Ramsin
what is your background, if I may ask? Not many know about diiofantic equations. I remember doing a Project Euler problem that dealt with these things. As it turned out, I had to search Google for some theoretic results first.
Piet Souris wrote:@Winston
I'm really surprised about you fanatism. Never knew you were in these kinds of problems! To finish with a famous saying from 'Are you being served': keep up the good work!
Also, if we have (x + y) mod z, that is equl to (x mod z) + (y mod z), and that should enable us to avoid using big integers.
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
There are three kinds of actuaries: those who can count, and those who can't.
Don't get me started about those stupid light bulbs. |