Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #79: Find the Closest Prime Number

Alekh
9 - Comet
Spoiler
79..png

 

just a single iterative macro

VanDeSurk
7 - Meteor

Cool Challenge, taught me iterative macros.

EricR
Moderator
Moderator

Takes a little while to run, but it works.

RWvanLeeuwen
11 - Bolide

Het I got the opportunity to build another app 😄

 

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

stack 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)stack 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)
Eleonora
8 - Asteroid

Here we go.

 

Spoiler
challenge 79 solution Eleonora Nazander.JPG

 

cgoodman3
14 - Magnetar
14 - Magnetar

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

 

Spoiler
iterative macroiterative macroApp interface and outputApp interface and output
Chris
Check out my collaboration with fellow ACE Joshua Burkhow at AlterTricks.com
Zuza
8 - Asteroid
 
fmeo
8 - Asteroid
Spoiler
79.PNG
T_Willins
14 - Magnetar
14 - Magnetar

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 MacroIterative Macro

 

Standard MacroStandard Macro

 

RoDO
8 - Asteroid

My solution

 

Spoiler
challenge_79_RODO_Solution_App.pngchallenge_79_RODO_Solution_Macro.png