Weighted Sum of Digits 2 - A Proposed New Problem

Back to General discussions forum

CSFPython     2024-08-21 08:05:12

The '2' in the problem title is there simply because there is already a "Weighted Sum of Digits" problem on the site. This one is quite different from the previous one and is not intended to be an extension of it.

gardengnome     2024-08-21 11:18:51
User avatar

Thank you! 'Special Digits 2' would also have worked. :)

Rodion (admin)     2024-08-24 07:10:13
User avatar

Well, "weighted" probably is somewhat misleading (perhaps intentionally) in here as weights do not depend on anything rather digit value itself (so it is more like mapping or encoding?) - but it seems all right :)

I'm ashamed to say I still can't find a key, though initially I thought this one is simpler than other Clive's puzzles (obviously missing the fact that as Ws are summed plainly, without modulo, they make a problem). It is somewhat relieving though to see that only Mathias was able to crack it yet. Though I'll consider his brief note as a vague hint and shall try attack this for some more time...

gardengnome     2024-08-24 11:34:57
User avatar

As CodeAbbey includes an educational element, I sometimes feel it would be beneficial to share general ideas how a problem can be approached. Of course without giving the full solution away. I indeed included a small hint earlier - this problem and 'Special Digits' share a number of similarities. Clive, if ok with you, and only then, I would like to add some general observations here.

CSFPython     2024-08-25 17:44:00

Apologies for the incorrect use of terminology. As I get older I am increasingly using the wrong words for things. Unfortunately, I rarely spot this myself but have to rely on other people to point it out. As Rodion says, the problem description is of a mapping rather than a weighted sum of digits. There was certainly no intention to mislead and I hope that the problem was still sufficiently clear, even with the wrong terminology.

Mathias has referred to the "Special Digits" problem so I looked this up and found, not surprisingly, that it is one of mine. I forget things very easily these days so had completely forgotten about creating it. Reading the problem description did bring some things back but I couldn't remember my solution. Rather than look at the stored solution, I decided to start again from scratch. It didn't take long to come up with the essential elements of a solution (in my head), presumably because I had solved it previously. I then read through the description of "Weighted Sum of Digits 2" and soon saw the similarities in the method of solution that Mathias has referred to. This possibly explains why he was able to solve it so soon after its publication. Although I agree with the similarities, I think that there is sufficient difference between the two problems for them to be considered as separate problems.

Mathias, I am confident in your judgement of being able to provide some general observations, without revealing the full solution. Please feel free to do this with this problem and for any of the other problems that I have created, or will create in the future.

gardengnome     2024-08-25 20:14:05
User avatar

Hi,

Despite their similarities, the two problems are most definitely different. Below are a number of points on how one might think about approaching the latest problem:

  1. Instead of looking at any ranges n1 to n2, could one simplify to ranges from 0 to n?
  2. W(n) can only take a small number of distinct values. Could one transform the problem to counting how often these values appear in a range?
  3. The ranges can get very large, and it is impossible to check every number in those ranges. How could one quickly precompute the answers for a small number of large ranges? And how does that help with the specific ranges in the problem?
Rodion (admin)     2024-09-01 05:43:22
User avatar

Dear Clive, no need for any excuses! I naturally thought the puzzle name is a part of a puzzle! As about remembering the problems - I suspect it is not the question of memory but of quantity, as you authored that many of them already!

Thanks to Mathias for hints. It is obvious one needs to be on some level of understanding to digest them though :) And honestly, I won't for my life see similarities between these two puzzles!

No 1 of hints is the only bright thought with which I quickly come up with myself (most probably taught by some previous puzzle by Mathias) - but others still need heavy mind work. Thanks, I'll try!

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