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

JamesCharnley
13 - Pulsar
Spoiler
JamesCharnley_0-1658161112449.png
JamesCharnley_1-1658161135892.png
JamesCharnley_2-1658161167462.png

This will be far from the most efficient solution but it's fully dynamic as far as I can tell. One macro is doing the higher primes and the other is doing lower, before comparing.

rachel_lynch
Alteryx
Alteryx

Use a macro, or use an analytic app. Take your pick! :)

Spoiler
rachel_lynch_0-1659122970724.png

 

Rachel Lynch
RobertZiegl
8 - Asteroid
Spoiler
2022-08-02 15_24_18-Alteryx Designer x64 - challenge_79_start_file_1.png

Abiramm1
8 - Asteroid

N.B. I reckon I made this challenge a lot harder than I needed to

Spoiler
I used 2 iterative macros (1 to check if the number was prime and if not add 1 to it, and the other to do the same but -1 from it). This gave me the closest higher and lower prime numbers, then I subtracted them from the original number and took the one with the lowest difference as the final output (if they have the same difference then both are counted)

Abiramm1_0-1660142682957.pngAbiramm1_1-1660142695871.png

 

ExploreMore
8 - Asteroid
Spoiler
Screenshot 2022-08-11 142044.pngScreenshot 2022-08-11 142110.png

  

bkclaw113
9 - Comet

Used a combination of an iterative macro to keep looping until I found a solution with a batch macro nested inside which check each increasingly distance number from the starting point to see if it was prime.

davidhardister
8 - Asteroid
Spoiler

davidhardister_1-1661199576423.png

davidhardister_0-1661199526135.png

 

ahsanaali
11 - Bolide
Spoiler
Spoiler
ahsanaali_0-1661337328955.png

 

Brian32
8 - Asteroid

Challenge Solution:

Spoiler

Brian32_0-1661777554112.png

 

grazitti_sapna
17 - Castor

Here is my solution.

 

grazitti_sapna_0-1663136445321.png

 

Sapna Gupta