We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

[Sharing] Custom Formula Function 'IsPrime' to Judge Primality

gawa
16 - Nebula
16 - Nebula

Some of the data challenges I faced involved mathematical problems, and there were times when I needed to use prime numbers. However, finding prime numbers in Alteryx is quite difficult. The available method is using the Macros and/or the Generate Rows tool, which is time-consuming and not practical for large primes.

So, I decided to create an original function 'IsPrime' using the Custom Formula Function(by C++ DLL) to check for primality, and I'm sharing it here in the hope that it might be helpful to others.

 

The attached ZIP file contains IsPrime.xml and IsPrime.dll. With reference to this web site, save these files in the proper folder to enable the custom formula function in your computer. 

https://help.alteryx.com/current/en/designer/functions/build-custom-formula-functions.html

 

I've also attached a sample WF for your reference, that is to find prime numbers less than 100 million. It takes about 10 seconds(As it uses C++ native language, it's very fast)

image.png

 

Hope it would help!

2 REPLIES 2
Pilsner
13 - Pulsar

That is impressively fast. This will be a very useful function for both build and run time, thank you for sharing @gawa 

caltang
17 - Castor
17 - Castor

Excellent add-on!! We should have this built in for Alteryx!

Calvin Tang
Alteryx ACE
https://www.linkedin.com/in/calvintangkw/
Labels
Top Solution Authors