We’ve extended Inspire Early Bird Pricing until March 1. Register now and enjoy 20% off conference passes and 10% off training passes. P.S. Don’t forget to bring friends! When you sign up for five or more tickets, you get an extra 20% discount on conference passes. Learn more now.
alteryx Community

# General Discussions

Discuss any topics that are not product-specific here.

## Advent of Code 2023 Day 9 (BaseA Style)

Alteryx Community Team

28 REPLIES 28
13 - Pulsar

Another breath of fresh air. Very satisfying problem to solve. Reminded me of my high school days, solving for the degree of a polynomial sequence (That knowledge didn't help a ton, but those were happy memories for a weirdo like me)!

Spoiler
Main Workflow:

Batch Macro (For part 1):

"Reverse" Batch Macro (For part 2):

Iterative Macro (Finds 'Predictions' for given input row):
13 - Pulsar

Why does this feel like the calm before the storm...

Spoiler

Macro:
15 - Aurora

Today's problem was not as difficult as yesterday.

Spoiler

13 - Pulsar

Today's one is easier than yesterday and can go out now!

Spoiler
I reverse the input data for Part2 and it works well!

13 - Pulsar

Pretty happy with my simple-looking no macro solution. Naturally, there's a long formula hidden inside. :) I like to generate formulas like that in Excel so there's fewer opportunities for typos and so that I can make changes efficiently.

Spoiler
It's all thanks to @NicoleJ and GetPart() which means I can FINALLY iterate through a sequence of multiple numbers all stored in a single cell. Would not recommend for a real automation solution... but I have always wanted to do something like this for AoC. Too messy with left() and right() and regex_replace().

12 - Quasar

Overall, I'm pretty happy with this one. Part 2 took me longer than it should have, because I made a small change right after reading the problem that threw off the rest of my logic. It took me awhile to remember I'd done that and to fix it. Regardless, I was able to use the same exact macro for both part 1 and part 2, which I count as a win in AOC.

Spoiler
Part 1: I used an iterative macro to difference the data. Then I took that output and found the last row's value across iterations and summed them together with the last number in the sequence.

Part 2: Same approach, but I reversed the order of the data going into the macro. At some point I thought it was a good idea to reverse what value got subtracted from what value, which was a bad idea, and is what threw off my answer for part 2. I couldn't figure out why the identical logic I used for part 1 wasn't working, and it is because I was indeed NOT using identical logic. Regardless of how quickly (or slowly) I got there, it was refreshing for the answer to be as simple as reversing the sort order of the values.

Workflow:

Macro:

EDIT: Super intrigued by your approach @clmc9601 ! I can't dive into it right now because I'm on 2023.1 and missing one of the formulas you used, but I'm fascinated.

17 - Castor

My solution. I've been recalling how to make the Iterative macro more and more.

Spoiler
I heard that part 2 is reverse of the part 1 from @DaisukeTsuchiya , so I made the reverse input version for part 2.

Part 1 Macro

Part 2 Macro
I removed the result calculate part from part 1 macro.

Part 2 Reverse version macro(I only modified the final expressions. )

14 - Magnetar

I don't have much chances to use Iterative macro in my daily business.

But this month I may use more cases than all I have used in the past :)

Spoiler
Main

Batch for Part 1

Batch for Part 2

Iterative Macro to get the Next Value
17 - Castor

I remake the workflow. I organize my workflow by working only what I should do.

Spoiler
At part 2, I simply reverse the input from the part 1.

Labels