Discussion thread for day 13 of the Advent of Code : https://adventofcode.com/2020/day/13
Here's my Part A.
Added in the tools at the end to get to single cell answer.Part B I don't think is an iterative macro, I think it's a case of getting a calculator out.
Here's my solve - BaseA for 95% but needed some true integer maths for last part
All maths for part 2 - googling "simultaneous equations modular arithmetic" reminded me of the maths I had long since forgottenBut had to use Python tool to correct for inaccuracy in double arithmetic.Will do a version with some Abacus functions
When I need to use pen and paper I know I'm in trouble. What a brain melt! I did it baseA with an iterative, works with my input. Once the headache leaves, I'll try to read and see other people's solutions 😅
and the macro
A summary of my thought process:
I started withnumber 3, offset 0number 5, offset 1number 7, offset 2number 11,offest 3
3&5 --> the first number that qualifies is 9 (mod(9,3) = 0 && mod(9+1,5)=0).Then I need to find a number that qualifies for (3,5) and 7. I start with the first number that qualifies for the previous condition, go in increments of (3*5) --will all keep qualifying for mod(z,3) = 0, mod(z+1,5) = 0 -- until I find one that qualifies mod(z+2,7) = 0 (the first number that qualifies is 54)
For the next, I'll start at 54 and increase in increments of 105 (3*5*7) until I find one that qualifies mod(z+3,11) =0. (789).And so on.
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.
https://github.com/NedHarding/Advent2020/blob/main/Day13.yxmd
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!
https://github.com/NedHarding/Advent2020/blob/main/BigMult.yxmd
Happy with my solution, I noodled on it all day before it finally hit me
EDIT: I think my logic is similar/the same as @dsmdavid
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...
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 panneauxsolaire.be 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.
Avec comparateurdenergie.be 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)...
https://comparateurdenergie.be/
https://rmsolutionsgroup.be
https://energierenouvlable.be