Number String Multiples of Thirteen - A Proposed New Problem

Back to General discussions forum

CSFPython     2025-04-04 07:36:37

This is intended to be a fairly straightforward problem, although some thought is needed for an efficient solution.

qwerty     2025-04-04 14:37:09

Impossible to solve... One must consider 2^400000 - 1 combinations in third example, this is obviously too much.

qwerty     2025-04-04 14:48:20

Nevermind, I didn't notice that someone already solved this problem, sorry!

zelevin     2025-04-04 15:00:42

Generally speaking, counting how many does not necessarily imply actually going through all possibilities. The 2^40000 number is a major hint for you not to do that.

That said, I wish I had more time to work on CodeAbbey problems these days; work has been busy.

zelevin     2025-04-04 15:52:25

...and THAT said, this is a great problem, and I fully encourage y'all to work on it.

Thanks, Clive!

gardengnome     2025-04-04 16:27:39
User avatar

O(13*N), not O(2^N). :)

TestUser     2025-04-05 07:15:40
User avatar

Impossible to solve

Just thought the same yesterday, when received the problem from Clive!

However yesterday was an annoying busy workday - and today at morning I tried to think carefully - as many Clive's problems are DP-based, how could this be done step by step. Perhaps Clive's puzzles are one of the best sources to train one's skills in this direction.

Solution soon started to dawn in my head, but I'm amazed I was able to compose these dozen lines at last - it took perhaps couple hours of slow thinking on a small example. This reminds me one of the first problems proposed by Clive, about train merging.

I join Vladimir (zelevin) in praising the puzzle - it really allows to work out solution by and by, not demanding to know some clever algorithms and anything besides arithmetics...

One must consider 2^400000 - 1 combinations

Yep, in such problems (especially when Clive asks for result to be given by modulo of some large value) - the problem size is a blatant hint that one must not consider brute-force approach :)

gardengnome     2025-04-05 19:07:30
User avatar

And the ChatGPT plague has reached CodeAbbey. :(

Rodion (admin)     2025-04-05 19:24:18
User avatar

Do you mean this new user named Luis? I guess ChatGPT was here for quite some time already (I wrote before) - but I thought mainly for rewriting other code...

gardengnome     2025-04-05 19:31:02
User avatar

Yes. ChatGPT suggest identical method names and structure.

Rodion (admin)     2025-04-05 19:36:46
User avatar

Thank you. It's funny of course to see the person do not use input() anywhere except the most recent problem(s). Let's allow him to waste some more efforts and wipe solutions bit later %)

ecolog_veteran     2025-04-05 20:18:52
User avatar

What's the point making ChatGPT solve problems from here instead of coming up with the solution yourself?

It's so much more exciting when your method actually solved the problem despite it seeming impossible to solve at first glance.

On the other hand, who am I to judge anyone.

Rodion (admin)     2025-04-06 05:48:25
User avatar

It seems some amount of students are driven here by their professors with order to have such a number of problems solved or such a number of points gained (judging by someone's profile info). For them there is no much excitement in solving I guess :)

I looked into "Funny Words Generator" solution and tried to ask DeepSeek

I need your help in deciding whether code in Python is written by student or generated by ChatGPT

after kiloton of verbose exchange and passing sample to it, the last answer ended with:

The code leans slightly more toward ChatGPT-generated due to:

Idiomatic generator usage (yield, infinite loop).

Clean but minimal docstrings (ChatGPT often adds them even when unnecessary).

Lack of edge-case handling (ChatGPT assumes happy-path unless asked).

Boilerplate (if __name__ == "__main__" for a small script).

...

How to Confirm?
Ask the student:

"Why did you use % 19 and % 5 instead of len(CONSONANTS)?"

A student might say, "I counted the letters," while ChatGPT would explain modulo arithmetic.

"What happens if the seed is negative?"

A student might not know; ChatGPT would explain the modulo behavior.

Funny ideas. We shall try of course, but obviously these things become cunning nowadays. It offers help in rewriting code in "more student-like style"...

Rodion (admin)     2025-04-06 05:59:29
User avatar

This fellow Luis added a few more problems and seemingly is following suit. His account is blocked now.

I would ask a hint (from Mathias or whoever is able to make it work) - do you feed all this lengthy enough problem description (for this one, with string concatenations and modulo 13) to ChatGPT and it immediately spits out the solution - or need to simplify request somehow?

gardengnome     2025-04-06 06:59:28
User avatar

Hi Rodion, I've shared the exact prompts and code produced with you.

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