ACT NOW: The Alteryx team will be retiring support for Community account recovery and Community email-change requests Early 2026. Make sure to check your account preferences in my.alteryx.com to make sure you have filled out your security questions. Learn more here
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Euleryx Project 8 - Largest Product in a Series

Pilsner
13 - Pulsar

Euleryx Problem 8 - Largest Product in a Series

Pilsner_10-1758273247591.png

 

 

 

 

My workflow and answer:

Spoiler
Pilsner_11-1758273341130.png


Answer: 23514624000


Last Weeks Favourite Solution:
Another tough decision but, with a macro free solution that ran in under 1 second, @AkimasaKajitani's solution leveraging a generate rows has won this weeks award. The generate rows doesn't just check for factors but is even able to tag the prime numbers with a "-1", all in a singular tool. If you want to check you this solution, please view it on page one of last weeks post or by clicking here


 

Mathematical Theory – The Truth

Yes, throughout this series, my intention was to try and solve these problems using some form of mathematical theory to help optimise the solution. However, problem 8 has got me stumped. Whilst there are some time-saving techniques we could use, such as ignoring any groups that contain a 0 (as their product will just = 0), I could not think of any significant theories to apply here.

 

 

Pilsner_12-1758273807431.gif

 

 

On the bright side, this does give me the opportunity to join Team Brute Force! If you are still interested, here's how I tackled the problem.



Method:

As with any problem, no matter what approach you take, you need an input to begin. In this case, I pasted the 1000-digit number into the text input tool, then began to solve the problem:

 


1)  Use Regex to remove new lines and then tokenise the number to get one digit per line.

Pilsner_3-1758273166677.png

 

 

2) Create a Record ID and then generate 13 rows per digit. (If we are creating groups of 13 consecutive numbers, each digit will appear in up to 13 groups).

 

Pilsner_4-1758273166678.png

 

 


3) Create Group IDs. Now we have 13 copies of each digit, we can allocate their groups based on their Record ID and RowCount.

Pilsner_5-1758273166679.png

 

 

4) Find the product per group, and filter to groups with 13 digits only (full groups).

 

Pilsner_6-1758273166680.png

 

 

5) Sort descending and sample your top answer.

Pilsner_7-1758273166681.png

 

 

6) Submit your answer to the Project Euler Website!

M2GIF.gif

 

 

 

 



Summary:

Despite taking a different approach from usual, we have arrived at a solution that not only runs but takes just 0.3 seconds.

Pilsner_9-1758273166820.png

With it being so quick, I'd like to think this was still an effective method, please share your thoughts below!

Want to find out more, follow this link to our introduction post - Euleryx: Let The Games Begin.

12 REPLIES 12
Hub119
12 - Quasar
12 - Quasar

Nothing a little tokenize and multirow can't solve...

Spoiler
PE-8.png
NicoleJ
Alteryx
Alteryx

Solved in Designer Cloud again! Can't beat the instant gratification of seeing your changes without having to hit Run!

Spoiler
Fairly reasonable tool golf today... though definitely on Team Brute Force. 
Euleryx8_DC.png

Cheers!
NJ
Director, Product Management
Alteryx
jrlindem
12 - Quasar

Struggled with the sequencing part.  Stared at @Pilsner's Generate-Rows + Formula section for a while before progressing.  And as for not currently being on 2025.1 I had to longhand the multiplication due to a lack of Product functionality in my Summarize tool.

Spoiler
jrlindem_0-1761856504480.png

 

Labels
Top Solution Authors