community
cancel
Showing results for 
Search instead for 
Did you mean: 
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Weekly Challenge
Do you have the skills to make it to the top? Subscribe to our weekly challenges. Try your best to solve the problem, share your solution, and see how others tackled the same problem. We share our answer too.
Unable to display your progress at this time. Please try again a little later, or contact an administrator if you continue to see this error.
Getting started with Designer? | Start your journey with our new Learning Path!

Challenge #79: Find the Closest Prime Number

Alteryx Partner
Spoiler
79..png

 

just a single iterative macro

Alteryx Partner

Cool Challenge, taught me iterative macros.

Moderator
Moderator

Takes a little while to run, but it works.

Alteryx Certified Partner

Het I got the opportunity to build another app

 

Spoiler
79 app.pngthe app takes one integer value between 1 and 10000 and uses two iterative macros (each walking 5000 iterations)

79 one macro of two.pngstack exchange has this page with a complete and working function (I tested it on three values just to make sure the output is as intended)
Asteroid

Here we go.

 

Spoiler
challenge 79 solution Eleonora Nazander.JPG

 

Comet

Did this as per the question by finding the first prime number <= number entered.

 

Spoiler
Challenge 79b.PNGiterative macroChallenge 79a.PNGApp interface and output
Asteroid
 
Asteroid
Spoiler
79.PNG
Bolide

This made me go back to my college math theory class (although I had to look up the formula online).  Standard macro is only to keep as a nice package - iterative macro inside it does the real work.  I limited it to a maximum test number of 100K as the larger the number the exponentially longer the macro takes to run.  The standard macro also includes a Test tool in case the iterative macro hits the iteration limit before calculating all primes (won't happen the way with limit at 100K).

 

Workflow:

Spoiler
Workflow 79.JPG

 

Macros:

Spoiler
Iterative Macro.JPGIterative Macro

 

Standard Macro.JPGStandard Macro

 

Alteryx Partner

My solution

 

Spoiler
challenge_79_RODO_Solution_App.pngchallenge_79_RODO_Solution_Macro.png