Challenge #79: Find the Closest Prime Number
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
aplenos
8 - Asteroid
09-18-2022
05:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
acarter881
12 - Quasar
10-02-2022
02:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here's my solution.
olga_strubbe
11 - Bolide
10-07-2022
09:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I used the same approach in solving the challenge as provided in the solution. Learned a ton! Thank you.
Divya_Bidarahalli
8 - Asteroid
10-09-2022
04:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Pete_Rodgers
Alteryx Alumni (Retired)
10-24-2022
03:41 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Spoiler
I did it the long inefficient way with more lines to process than others, as sqrt approach caused my brain too much pain. However I learnt some new functions thanks to reviewing the official answers - ABS() and mod(). borrowed some formatting to lay it out nicer and break up the logic.

This was a really good challenge, that had me scratching my head, more about the Prime calculations than macros!
FinnCharlton
13 - Pulsar
11-08-2022
01:03 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Just don't use a number over ~6 digits! Could definitely be improved to deal with bigger numbers.
Kinga
8 - Asteroid
11-08-2022
09:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
martinding
13 - Pulsar
11-11-2022
10:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
9 - Comet
11-18-2022
08:18 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
AndrewHoData
8 - Asteroid
11-25-2022
06:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Created analytic app solution where it finds closest prime number < Number
Spoiler


Just for reminder for future me to remember to tick this box so that it'll show up in the analytic app results
Tested with other values to see if it works