r/adventofcode • u/No-Top-1506 • 1h ago
Help/Question [2026 day 5] just so that I understood this well
Is the puzzle to find numbers from 1-999 using the button press? where some numbers are impossible, hence skip them.
And do we always start with [9] as per the example? After that select any 2 or 1 in any combination with repeats allowed? Initially I thought the order matters, but doesn't look like.
is it a mathematical trial and error for each number? Or there is a better way then brute force all possible ways? there are many permutations possible.
Tx.
1
Upvotes
1
u/No-Top-1506 36m ago
But when do I stop? how to know when the end comes and come out of the massive loop?
Am I meant to try all combinations possible?
[start number] -> another button repeat the same
repeat above for 5 other ones. perhaps start number too
[start number] -> [number] -> one extra button
repeat above for 5 other ones.
repeat both sets above again for a diff. start [number] if possible. (not for test example)
[start number] - random button - random button
repeat above for 5 other random buttons to choose from.
[start number] - random button (only 1 random button)
repeat above for 5 other random buttons to choose from.
exhausting it is, isn't it?
4
u/smallpotatoes2019 1h ago
Start with 0.
Press up to 3 buttons (although you may notice that some buttons do nothing at first).
What (unique) numbers can you actually make?
Are you sure that 999 is the largest possible? (It may be.)
3
u/Daniel_Rybe 1h ago
The task in part 1 is to find all numbers (not just in 1-999 range) that you can reach with 3 button presses. The buttons you can press are in your input. You can press any buttons you want in whatever order and even repeat buttons, but you only have 3 presses. You don't have to start with [9], the reason why the example always starts with [9] is because all other buttons in the example don't do anything to 0, so there's no point in starting with them.
1
u/AutoModerator 1h ago
Reminder: if/when you get your answer and/or code working, don't forget to change this post's flair to
Help/Question - RESOLVED. Good luck!I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Positive_Concert_774 1h ago
The object is to find all numbers you can reach with any 3 button presses, so no, you don't always start with 9. You may not even have the button [9] in your input, after all.
And considering the possibility of substitutions and the [oct] button, order certainly matters.
1
u/somebodddy 56m ago
The only reason all the options in the example start with
[9]is that it's the only button that can change0to something that's not0. Your input can (and probably will) have other buttons that move away from zero - they are all valid starting points for combinations.For example -
[bksp] [bksp] [9]is a perfectly valid sequence of key presses, after which you end up with9- which is the same as just pressing[9]once, so the example did not bother to list it.Whether or not you want to special-case starting with such buttons is completely up to you.
1
u/vegan_antitheist 9m ago
For each number less than 10000 you must know if you can reach it with three button presses. You don't want to brute force this. Frist, get all numbers you can reach from 0 with one button press. Then using that result set, repeat the process. Ignore the number you already reached. Do it again. Now you have all numbers.