Lucky 7 - A Proposed New Problem

Back to General discussions forum

CSFPython     2025-05-02 07:58:14

This is intended to be a fairly straightforward problem.

TestUser     2025-05-03 05:52:51
User avatar

Thank you, Clive!

I also thought "fairly straightforward", moreover that it seems familiar after some puzzles you taught us earlier - but it anyway appeared that case when one writes code in ten minutes and then wastes hour plucking out remains of hair and thinking what subtlety could be missed, causing larger examples to go wrong. These subtleties make all the fun :)

As a side note, this Lucky 7 seemingly became your 70-th puzzle here!

Also I wondered for a few minutes, as we use LCG for many problems, could the approach with "cracking" it be used somehow to calculate solution even perhaps without running through the whole sequence. But it seems a vain idea as the solution (seemingly) has no linear dependence on the input numbers. Or at least I'm too ignorant in the field anyway to figure out such an approach.

CSFPython     2025-05-03 09:08:53

Rodion,

I'm pleased that you enjoyed the problem.

As for the LCG, I don't think that there is any likelihood that someone could use its behaviour to find the solution to a problem without actually solving the problem. For this to be a possibility the data processing would need to be very simple; so much so that the problem itself would be trivial.

The LCG is a very useful tool to generate data for Code Abbey problems. It provides a good range of values and is a reasonably good approximation to a random number generator (now that the M parameter has been changed from the value used in early problems).

With M = 2097169 the LCG returns a number in the range 0 to 2097168. All numbers in the range (except one) are generated exactly once before the sequence repeats.

The one number in the range which is not generated is 1609087. If this number is ever chosen as the random seed then every generated number from that point on will also be 1609087. Clearly 1609087 should not be used as the random seed. However, the chances of choosing it accidentally are less than 2 million to 1 so it isn't much of a problem.

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