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

DanielG
12 - Quasar

Solved

aaziz2
8 - Asteroid

solution attached

tristank
10 - Fireball

I just did a prime number challenge so I added some logic and made it into an app :D

 

Spoiler
Screenshot 2023-12-11 201646.png
Tgigs
8 - Asteroid

My solution attached.

 

Used two iterative macros, one that checks the numbers up 1000 and one that checks the numbers down 1000.

Checks include sum of digits divisible by 3, and difference in sum of alternating digits divisible by 11, and divisibility by 2 and 5.

 

Not perfect approach but gets the job done

 

Spoiler.PNG

sknman92
8 - Asteroid

my solution! created two iterative macros to find closest prime preceding and succeeding the input number. then batched

snbandi
8 - Asteroid

My solution - Implemented using two macros. Nice exposure to all types of macros.

Rob-Silk
8 - Asteroid

Solution attached below:

 

Spoiler
Opted to use the double iterative macro approach so that the looping can end early if a prime number is found rather than using a Generate Row based approach

Main app workflow:
challenge_79a_RS_screencap.PNG

First (outer) iterative macro:
challenge_79b_RS_screencap.PNG

Second (inner) iterative macro:
challenge_79c_RS_screencap.PNG

App input and output:
challenge_79d_RS_screencap.PNG
Mikeimbi
8 - Asteroid

Challenge 79