Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

General Discussions

Discuss any topics that are not product-specific here.

Euleryx Project 8 - Largest Product in a Series

pilsworth-bulien-com
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.

8 REPLIES 8
pilsworth-bulien-com
13 - Pulsar

I appreciate that this week's post was a little late. Just as a heads up, next week's problem will likely be released on Friday as well, due to attending Big Data London mid-week. Thursday releases will subsequently resume.

Qiu
21 - Polaris
21 - Polaris

I will just go with mine 15s. 🤣 for now and check the 0.3 one later. 

Spoiler
Euleryx Project 8.jpg
Carolyn
12 - Quasar
12 - Quasar

I knew my 13 digit number couldn't have a 0 in it so I initially treated 0 as a delimiter. I then filtered for any numbers that were 13 or more characters. Then I ran it through an iterative macro where iteration 0 would take the first 13 digits, iteration 1 would take digits 1-14, etc. 

 

But then for v2, I was thinking about how the odds were good that my number also wouldn't have a 1 in it, probably not a 2, or even maybe a 3. So I treated 0123 as delimiters. I was left with a single 13 digit number, which was the solution.

 

I feel like that was cheating...? I dunno, it seemed too simple/neat :) If I had multiple results and/or results with >13 characters, I would've sent it through the macro and evaluated the largest product, but I didn't need to

 

Spoiler
2025-09-19 12_35_10-.png
AkimasaKajitani
17 - Castor
17 - Castor

My solution!

 

a simple solution!

 

Spoiler
I just use the Multi-row formula with 12 previous rows.

AkimasaKajitani_2-1758337661453.png

 


AkimasaKajitani_3-1758337779816.png

 


 

gawa
16 - Nebula
16 - Nebula

It's straight forward approach.

 

Spoiler
By combo of Generate Rows tool and substring() function, all pattern of 13 characters-string are created. This approach will allow us to minimize modification of WF or make WF variable by Analytic App, even when the target length '13' is changed.
image.png
DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

I solved it using a straightforward approach.

Spoiler
First, I concatenated the 1000 characters into a single string, then extracted substrings of 13 characters each. Using the Sum Tool's Product function, I calculated the largest product.

スクリーンショット 2025-09-24 090948.jpg
Yoshiro_Fujimori
15 - Aurora
15 - Aurora

My solution. With this data volume, I could not see difference in time if I the 13 digits contains "0" or not..

 

Spoiler
Workflow
    I compared the performance between with and without Filter tool.
Euleryx_8_workflow.png

Comparison of performance profiling between with / without filtering "0".

    After adding Filter tool (0.64 milli second), RegEx tool (to split to single digit), Select tool (to convert str to number)
    and Summarize tool (to calculate products) ran 23 milli seconds faster.
    So we may see more notable performance enhancement with a much larger data set.
    Euleryx_8_comparePerf.png

 

 

CoG
14 - Magnetar

String Coding Tool Golf

Spoiler
No fancy logic, just parse out single characters for each index. I made the workflow dynamic, which cost 1-2 extra tools:
Screenshot 0008-1.png
Screenshot 0008-2.png

Happy Solving!

 

Labels
Top Solution Authors