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 17 –Number Letter Counts

Pilsner
13 - Pulsar

Euleryx Problem 17 – Number Letter Counts

Pilsner_0-1763655169859.png

 



My workflow:

Spoiler
Pilsner_1-1763655178057.png

 

 

Answer: 21124



Last Week's Favourite Solution:

Some great solutions, leveraging the idea breaking larger numbers up into their separate components but for keeping up the idea of dynamic building and creating a macro with a variable power toggle, last weeks favourite solution goes to @Hub119 . Please find their solutions on page one of last week's post or click here.

 

Mathematical Theory:

This weeks problem is all about spotting patterns. If you used all the tricks, this challenge would be relatively simple to solve by hand, however as we have Alteryx we took a combined approach meaning I utilised some patterns but also counted some values out in full. Ill explain the actual method I followed shortly, but here is a brief description of what we mean, when talking about patterns.

 

First write out all the numbers from 1-99 in text form i.e:

1 = one

2 = two

3 = three

 

Now write out all the numbers from 101-199

 

101= One hundred and one

102 = One hundred and two

103 = One hundred and three

 

You should notice something familiar. All the numbers from 1-99 appear again, just with the prefix of “One hundred and”.

 

For the numbers 101-199, the words “One hundred and” appear 99 times. So instead of writing this out every single time, lets just count the number of letters in it once ( 13 letters) and multiply that number by 99 instead.

 

This isn’t the only pattern that occurs either, ignoring the teens, the same pattern occurs with the numbers 1-9 and 21-29, 31-39…. The units 1-9 and written out the same each time, just with a different prefix of thirty or forty.

 

Like mentioned above, I have not fully utilised every pattern as I believe the benefit of recognising some of these in Alteryx would be negligible in terms of run time, however, the same theory can be applied.



Method:

1) Begin by generating a list of the numbers from 1 – 1000

Pilsner_2-1763655235338.png

 


2) Next separate out the digits into separate columns os we can lookup their respective names seperatly. I reversed the string first to make sure that all units are in the same column, regardles of the total number of digits.

Pilsner_3-1763655348662.png

 



3) Because the “teens” are awquard, we need to consider them seperatly. (All other numbers end in a written value of one, two …. Nine, except for the teens). To handle the teens, make sure than any values of “1” in the tens column (RowCount2), is removed, and instead placed back in the units column (Row Count 1).


Pilsner_4-1763655358845.png

 




4) Now we need to lookup all the digits to convert them into their text values. The “Units” lookup can be applied to the hundreds and thousands collumn to, as we will deal with the words, “hundred”, “and”, “thousand” seperatly. (Remember the values in the initial RowCount column are reversed).

Pilsner_5-1763655369815.png
Pilsner_6-1763655382073.png

 



5) Pivot the “Units”, “Tens”, “Hundreds” and “Thousands” columns down so that all the numetic text is in the one column.

Pilsner_8-1763655397421.png

 



6) Count the number of charactors for each of the numbers written in the “Value” column, then sum these counts.

Pilsner_9-1763655405556.png

 



7) Next, we need to consider the number of times the words “Hundred” or “Thousand” appear. This will equal the number of values found within the respective columns.

Pilsner_10-1763655416446.png

 



8) Multiply these counts by the character count from the corresponding words.


Pilsner_11-1763655462986.png

 



9) Then we need to figure out how many times the word “and” appears. The word and will be used every time there is a value in the “hundreds” column, and in either the tens or units column.

Pilsner_12-1763655470371.png

 



10) Similarly to before, we need to count the occourances and multiple this by the number of charactors in the word “and”.

Pilsner_13-1763655480729.png

 



11) Finally, we can sum these three totals to get to our answer

Pilsner_14-1763655569888.png

 



12) Submit your answer to the Project Euler Website!

SaltSprinkleGIF.gif



Summary:

By spotting repetition within our sequence of numbers we were able to minimise the calculations required by counting the characters of certain strings once, then multiplying the values by the number of times they occur.

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

4 REPLIES 4
Qiu
21 - Polaris
21 - Polaris

Mine is quite lengthy but get what I need.

Spoiler
Euleryx Project 17A.png
DaisukeTsuchiya
14 - Magnetar
14 - Magnetar

I created an input with 29 representative numbers, and then processed the rest using the Generate Row tool and the Join tool.

Spoiler
スクリーンショット 2025-11-21 172408.jpg
Hub119
12 - Quasar
12 - Quasar

Minimal tools but LOTS of IF statement coding on this one...

Spoiler
PE-17.png
AkimasaKajitani
17 - Castor
17 - Castor

Unlike last week, I know my solution is not nice (in fact it's ugly) - I think I just didn't have a good enough understanding of the logic behind it.

 

Spoiler
AkimasaKajitani_0-1763777529321.png

 

Labels
Top Solution Authors