Find 3 Numbers - A possible New Problem

Back to General discussions forum

CSFPython     2023-07-03 22:25:31

This is a fairly straightforward number puzzle.

gardengnome     2023-07-04 05:54:31
User avatar

For N=955802742745951, I think 991, 982081 and 973242271 is a valid answer but the checker expects 0.

CSFPython     2023-07-04 08:09:22

Mathias, Thanks for the rapid feedback. You are, of course, absolutely right. I set out to design an easy problem but also wanted a unique answer so that the result could be checked without the need for further calculation. My first idea was to require the sum of X, Y and Z to be as small as possible. Unfortunately this made the problem harder than I had intended. In retrospect I should have stuck with the harder version because this makes it much easier to get a unique solution. Instead I decided to restrict the numbers which could be set in order to get a unique solution this way. The result of going through several versions of the problem was that my final version contained a glitch. It is fairly easy to fix but I shall check the program carefully before sending the updated version to Rodion.

I thought it was only a matter of time before I made an error in one of my problems. I am very grateful to have it flagged so quickly.

Rodion (admin)     2023-07-04 09:50:15
User avatar

Hi Friends! I'm impressed by the speed Mathias has come to "proof-solve" the task - and how quickly Clive has sent the fix :) It is uploaded so please re-check! Thanks a lot!

gardengnome     2023-07-04 11:05:48
User avatar

Thanks for the problem and the fix, all seems as expected now. And I know exactly how you feel; I always worry about stupid mistakes when submitting a new problem.

Rodion (admin)     2023-07-04 14:51:05
User avatar

Probably no need to worry much, first of all I'm definitely champion by amount of bugs in new problems :) next, your problems are provided to people for free, at the expence of your time, intellectual efforts etc, so it would be unjust to complain if some polishing is yet required :) thirdly, I solved it at last and see the puzzle demands good work to one's brains, and when it becomes less or more clear, person should already well understand the diversity of cases arizing here and particular way of generating numbers is not that critical.

However when you feel you would like to create a problem allowing non-unique solutions, feel free to call me for help (I believe necessary functionality exists for python "checker" code also, just not sure how well it is described).

kostis_k     2023-07-08 06:31:30
User avatar

It goes without saying (but here I am saying it) that we are all grateful for the amount of effort that you three, zelevin and others put into this site, be it via problem creation or "beta testing" new problems. It makes for a nice community. And all of this for free? At least a simple "thank you" is in order.

As a side note, Rodion, you had expressed in another thread your amazement at how Clive sometimes comes up with the problems that he does, because of course that's your perspective. You should know that for me (I guess for others too that aren't on the "puzzle creation" side) that's a common reaction for your puzzles as well :) Any puzzle really, regardless of author, that's not a trivial one, has a certain factor of "now, how could someone ever come up with that"?

Rodion (admin)     2023-07-16 12:00:11
User avatar

Hi, Konstantine!

Thanks for all your kind words and for revisiting us! About Clive's puzzles I meant they most always are really puzzles, requiring some "Aha!" moment. I myself generally have no much difficulty creating problems about some algorithms or implementation, but in the world of puzzles I feel like a toddler - both solving and inventing, I guess this is related :)

As a sidenote, when my colleagues at work or others around me start discussing Raspberry Pi I always mention certain outstanding person who managed to use it successfully as a workstation. Moreover I'd like also to thank you for explaning cases of Greek names - currently at work we interact with the team of fellows obviously of Greek origin (developers of SUI blockchain) and using the proper form of addressing is seemingly mutually pleasing :)

Jeroen Kloppenburg     2023-07-25 16:41:07

Given 319333591747, which factorizes as 467 * 881 * 881 * 881, the answer 881, 467*881, 881*881 was rejected over 467, 881, 881*881, even though it also satisfies the 3 conditions. Considering that generating input data until the code happens to generate an accepted output feels cheaty, maybe some additional information should be added about the extra conditions used to identify a unique solution.

Rodion (admin)     2023-07-25 20:16:58
User avatar

Jeroen, Hi!

Thanks for reporting this. I'll have a look and probably I can fix it by just amending the checker so it will accept any suitable answer, thus not touching author's data generation part. Hopefully Clive will approve this plan (or perhaps suggest some better idea).

CSFPython     2023-07-25 22:50:10

Jeroen, thanks for your feedback.

First let me apologise for what is clearly an unsatisfactory problem. It is now beginning to haunt me! I set out with what seemed like a simple idea, with the intention of creating a fairly easy problem. I also felt the need to have a unique solution for the problem checker. This is the element that created all of the confusion. My first idea was to add the constraint that the sum of X, Y and Z should be as small as possible. Some experimentation on this theme showed that the problem was then much more difficult than I had intended. In retrospect I should have kept it as a moderately difficult problem. Instead I tried various constraints but these either didn't really help or made the problem trivial. I then decided to severely restrict the test data in an attempt to get unique values. By that time I had 4 different versions of the problem and was getting quite confused. The version which I sent to Rodion contained a constraint which I should have removed. This resulted in a quick fix thanks to early spotting by Mathias. At this point I looked at the problem again and realised that there was scope for an answer like the one that you had submitted. Your answer would clearly be rejected if the condition for X+Y+Z to be a minimum was still in place. However, adding this constraint to the problem means that people will be pushed into designing sophisticated algorithms which will then be completely wasted in view of the restricted test data in use. I hoped that the algorithms being created would generate simple solutions to the problem, avoiding the type of solution which you have given, and hence getting the answer expected by the checker. Clearly I was wrong.

If Rodion can modify the checker to test that the 3 numbers meet the conditions of the problem then that will be the ideal solution to this mess. Thank you Rodion for the offer to do that. I will try to avoid making a similar mistake in future problems.

Rodion (admin)     2023-07-26 07:21:09
User avatar

Clive, thanks a lot for the quick reaction and the insight into the idea behind test data generation!

The amendment is just finished for the checker code, hopefully you can see it (there should be some button or link in page's interface) and review, for you'll see there are various cases to try and it's still possible something is missing or wrong.

Your explanations reminded me there were the first version of data generator, is it better to return to this early approach?

As a matter of fact it feels this minor flaw was to the better :) Mathias and Jeroen got chance to look deeper into the problem, I have an opportunity to recap how "advanced" checker works and also to share this forgotten knowledge to Clive! Just sorry if this addition is a bit clumsy.

CSFPython     2023-07-26 15:13:06

Rodion, Many thanks for all the hard work that you have put into modifying the checker to allow multiple different correct solutions. After one minor alteration (see below) it all works perfectly. I assume that, in future, if a problem needs to allow multiple solutions, that I can just send you an additional function which will take the user answer as its input and will then output either 'ok' or a suitable error message.

The current version of the test data is the correct one to use. My original version had a constraint left in which I thought I had removed!

The function "Checker" has two minor errors in the line just before the final return 'ok'. These are just two integer values which have not been converted to strings. The corrected line is:

+ str(N) + ' (' + str(divs[j]) + ' ' + str(divs[(j+1)%3]) + ')'
Rodion (admin)     2023-07-26 16:52:39
User avatar

Clive, thanks a lot for careful review! How can I be so inattentive! Perhaps we should better use template string, but I always forget how to write it properly :)

Hopefully it's fixed now!

I assume that, in future, if a problem needs to allow multiple solutions, that I can just send you an additional function

Yes, there was some clumsy explanation at the end - it works like this, if the expected answer starts with magic prefix, then the whole code is re-executed upon receiving answer from user, with two additional variables set (expected and answer) by which the code understands it is in "checking" rather than "generating" mode and may verify user's answer, producing varous messages on error. I'll gladly provide any assistance with this, for some problems it much simplifies the work even though checking all possible mistakes is a bit tedious...

CSFPython     2023-07-26 17:24:17

Rodion, thanks for the rapid response and for referring me to those useful notes on the site about dealing with multiple solutions to a problem. I didn't realise that they were there. I had looked at that page a very long time ago and think that the additional information has been added since. I shall remember that for future use. Thanks again for all the help.

Rodion (admin)     2023-07-27 10:38:03
User avatar

and think that the additional information has been added since

oh, yes, it was exactly so! instructions started to appear after you proposed several problems and probably when Mathias and Vladimir joined or even some time later - this "advanced" feature was added and described, so it is most probably easily went unnoticed (probably, Vladimir utilized it once).

zelevin     2023-07-27 17:19:54

I think my last three problems use the "verify the answer" mechanism: The Mirror Maze allows more than one solution, Shredder treats consecutive white spaces as one, and Sorites allows the contrapositive.

I should find some time to put together a puzzle or two. Just need to make sure that the simpler one of the two isn't immediately obvious and that the harder one is actually solvable.

stannyrusota     2023-08-14 07:03:36

("Answer should contain integers only") Hi I can't figure out why I get this as an expected answer when submitting my results

(608912657 863 4786840969 77114156402999 1178381 486209 3218930187127)

These are the data I used the last time and my results were (0 0 43 1609 69187 599 358801 214921799 0 0 0) but the expected answer was ("Answer should contain integers only") and my answer was marked as wrong All the answers are returned as integers in my code. Can you please help me understand the issue?

CSFPython     2023-08-14 09:08:57

Hi stannyrusola. The simple answer is that your submission is wrong. There are solutions for both 608912657 and for 3218930187127. There are so many permutations for getting a wrong answer that it is difficult to provide meaningful error messages for all of them. I apologise for the unhelpful message that you have here. I think that the checker took one of the 0s to be an attempt to use 0 as one of the three numbers (i.e. not a positive integer as required). If you get the same error message again you can safely assume that you have failed to find at least one of the soluble cases. I hope this helps.

stannyrusota     2023-08-14 10:41:33

Atleast now I know that I have to improve my code

I was just not sure what the error message meant.Thanks for your help CSFPython

nalbe666     2024-10-04 11:10:22
User avatar

Hi!

Checker says: There should be solution for 9209383872631799.
Can't agree with it, cause 9209383872631799 = 1559 ^ 5. No way to represent it in form of different divisors.

CSFPython     2024-10-04 11:58:00

nalbe666 Hi,

You are making at least 1 incorrect assumption. With a little thought you should be able to figure out the answer to the problem that has stumped you. You will then probably have sorted out all of the relevant aspects of the full problem. You may need to read the question again too.

nalbe666     2024-10-04 15:11:17
User avatar

Thanks for replying. Somehow, I misunderstood the last part of the condition. :\

Please login and solve 5 problems to be able to post at forum