Euleryx Problem 4 - Largest Palindrome Product
My workflow and answer:
Answer: 906609
Last Weeks Favourite Solution:
Last week's episode had some really interesting discussions, thank you everyone for being so detailed in your answers. This week, we have selected @patrick_digan's solution as our winner! We loved the idea that you could calculate which factors were prime by simply checking if they were divisibly by the other factors. If you want to check out @patrick_digan's post, find it on page two of last weeks challenge, or click here.
You may also have noticed that we have been recognised with an official "Project Euler" label, now attached to all of our posts. Thanks for the amazing feedback and support all, shout out @Carolyn for being the Euleryx mascot!
Definitions:
Weighing up the options:
Two main routes sprang to mind here:
On the face of it, an iterative approach sounds like the quicker option as it involves fewer calculations; however, if the Advent of Code has taught me anything, it's to properly consider all options. If not, you may pay the price with a lengthy run time!
If we went the generate rows route, we would need to calculate the product of every 3-digit number pair. As a rough estimate, this would be 1000 * 1000 calculations (1,000,000). Whilst this seems like a large number, this is not a great deal of records for Alteryx, so I decided to go with this method. (Plus, I had a couple of ideas in mind to significantly reduce this number.)
Method:
Summary:
Whilst the solution this time was somewhat brute force; we were still able to use a couple of tricks to reduce the computation required.
Want to find out more, follow this link to our introduction post - Euleryx: Let The Games Begin.
Also very straightforward.
Simple enough challenge. I fear I'm being coerced into a false sense of security and Euleryx is going to rip that away soon with much more difficult challenges...
I basically created all sums, used a right and a left string function on the product, and then filtered / took the highest!
I've been looking forward to reading these, there are some great solutions!
@gawa , that was a very clever assumption. It took me a moment to get my head around your idea, but I like it a lot!
I never would have thought to start with the palindromic numbers, @Yoshiro_Fujimori. I have checked, and I believe your answer was correct for 4-digit numbers, too. This is such an efficient solution.
Simple Brute Force, but nice 3 Tool solution. I was trying a different approach, so my Generate Rows Tool is inefficient
Fun problem!