Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

General Discussions

Discuss any topics that are not product-specific here.

Advent of Code 2020 - BaseA Style (Day 13)

16 - Nebula
16 - Nebula

Discussion thread for day 13 of the Advent of Code :

7 - Meteor

Part 2 was hard!  I don't know anything about the Chinese Remainder Theorem...  And I wasn't finding any simpler solutions.  So I cheated and read @dsmdavid 's solution!  Brilliant!  Somewhat embarrassed I didn't come up with that on my own.  Anyway, I did it first in Excel and then in Alteryx as an iterative macro.  So simple.


While I was headed the other direction I wrote a quick infinite precision multiply for Alteryx.  Did anyone but me know the summarize tool already does infinite precision for fixed decimal sums!



17 - Castor
17 - Castor

Happy with my solution, I noodled on it all day before it finally hit me

Part 1 was pretty simple, but for part 2 my logic went like this: for the sample with 17, x, 13, 19 Start with bus 17 and bus 13. Since bus 13 needs to be 2 minutes after bus 17, we need to check bus 13's next arrives after bus 17 plus the necessary space. So when bus 17 returns at 17 and then we add the 2 minutes, bus 13 would next return at 26. This is 7 high (26-(17+2)), so we need to try at the next stop. At 34 minutes, bus 13 would be at 39 minutes. Again, it's 3 high (39-(34+2)). Keep going until you get to 102 minutes. Bus 13 would next return at 104 (13*8). This is 2 higher. perfect! Now in order to keep these 2 in sync, we can keep adding 221 minutes (13*17) and bus 13 will always be 2 minutes after bus 17. Now we add in bus 19, which needs to be 3 minutes after 17. Our first check is when bus 17 returns at 102 plus the 3 minutes. Bus 19's next return is 19*6=114. This is more than the needed 105. So we add 221 to 102=323. Bus 13 and bus 17 are still in sync. Bus 19 would next return at 342 compared to the needed 326. Still too high. This goes on until 3417 where bus 17, 13 and 19 are all in order. If we needed to add more buses, we would then add 221*19=4,199 minutes to keep all 3 in order. Since there really isn't that much math going on, my solution gets there in a couple seconds. The engine is really 1 generate rows tool inside my iterative macro. And I'm using too many multi-rows, but I didn't feel like cleaning it up.




EDIT: I think my logic is similar/the same as @dsmdavid  

14 - Magnetar
14 - Magnetar

Number patterns.  Thankfully they used all prime numbers.  For part b it led to an iterative macro inside of an iterative macro, an iterative-ception, a dweam within a dweam...

For me finding the pattern was key.  It's similar to the mod approach, but attacks it as an iterative approach.  Since the numbers are all prime, each additional bus (prime) adds to the multiplier for the next set inside the iterative macro in the iterative macro, so 13 looks by 7s, 59 looks by 91s (7*13), 31 looks by 5369s (7*13*59), etc.  If the numbers were not prime, then least common denominator comes into play, which could be determined by subtracting the first valid number from the second valid number to apply to the next iteration.  In the case of the first sequence it would be 168-77 = 91 for the multiplier for bus 59.  Since each iteration looks at numbers going up by the multiplier, the macros get to the answer quickly.  This ran in 3.4 seconds.


Iterative MacroIterative Macro


Iterative Macro 2Iterative Macro 2



5 - Atom

Pourquoi choisir un panneau photovoltaique et l’énergie solaire ? De nos jours, il est important de pouvoir compter sur soi-même, et grâce aux panneaux solaires, vous êtes votre propre patron. 


Notre vision chez est de permettre à chacun la possibilité de transformer sa propre maison en une centrale écologique rentable en économisant de l’énergie et de l’argent. 


Réservez un devis personnalisé, gratuit et sans engagement. 

5 - Atom

Avec vous pouvez comparer les installateurs des panneaux photovoltaïques wallonie et calculer immédiatement combien vous pouvez économiser avec un système d’énergie renouvelable (panneaux photovoltaique, pompe à chaleur, boiler thermodynamique et chaudière à condensation)...