[Community Puzzle] Prime Transformations

Hello,
I have a question about the last testcase for “Prime Transformations” https://www.codingame.com/training/expert/prime-transformations:
The numbers are: 2860866142560 = 2^5 * 3^3 * 5 * 17 * 19^2 * 29 * 61^2 and
78604642094119757 = 7 * 11^2 * 19^2 * 29 * 31^2 * 37 * 61^2 * 67.
While the first number has 15 factors, the second one only has 12.
So, how can this be a valid mapping?

My code already passed the validators, but this input still confuses me.

JBM did mention this issue in the thread dedicated to this puzzle contribution. And this was the reason why I did not approve it.

I will investigate it further this afternoon, so as to suggest a fix.

Sorry for doubleposting (I didn’t find it with the search function).
And thank you for replying and for fixing in advance.

One possible fix (if not already posted) could be changing the last line to 2920467520530 78604642094119757

The creator’s code passed this test?

Unfortunately, I have access to it no more.

To be honest, there is a way to solve the problem. If you forget about the fact that the last clue is invalid, then you can gain just enough information to deduce that 29 can only map to 7.

Nevertheless:

  • the statement does not mention malformed clues,
  • solutions based on finding the “most general transformation” will fail miserably because of the inconsistency of this last clue.

I can confirm that replacing 2860866142560 with 2920467520530 does fix the issue in test 5.

And fortunately, the associated validator is correct.

Looks like mentioning problem bugs in contributions is not enough to have their approval delayed, when taking action-any-action is incentivized. I’m afraid this comes as no surprise.

Oh, does this mean I can still submit my correct code? That’d be good news :slight_smile:

I haven’t attempted to solve this puzzle yet. I’ll put it high on my list because if I can validate what you are saying, I can probably do something about it.

One thing I was able to do very quickly is to check the original author’s (@TheNinja) code. It passes all tests and validators.

  • danBhentschel

One cannot publish (save a published contribution) if the provided solution doesn’t pass the test. This feature has been added something like two weeks ago and it is retroactive (we’ve unpublished contributions which didn’t validate this)

1 Like

One of my contributions became a draft because of this, my solution was buggy.
This feature is a very good idea.

In this problem’s case, the issue is more “input not conforming to statement” than author program bug.

Okay. So I have solved this puzzle, and I agree. The 5th test case doesn’t follow the problem statement. The last pair of numbers has a 7 -> 8 prime factorization mapping. The statement clearly indicates that each number pair should have an n -> n factorization mapping.

That being said, I will point out that my own solution code is agnostic to this discrepancy, as I assume is the solution of all others who have solved the puzzle already. So I can understand why this error might have been overlooked by many of the reviewers.

I have verified that this does, indeed, rectify the problem (8 -> 8 prime factorization mapping), and is still solvable by both my code and @TheNinja’s code, and so I have changed the test case accordingly. Thanks for the suggestion.

As an aside, I have also changed the stub generator to read [[X]], [[Ai]], and [[Bi]] as long instead of as int.

  • danBhentschel
3 Likes

This puzzle (Prime Transformations) is crazily complicated. It is more about logical deduction than copy&paste a prime function. Thanks the earlier efforts to fix hidden bugs I can pass it without too much frustration.

interesting puzzle! really enjoy it, thanks !