Updated specific locations to be searchable, take a look at Las Vegas as an example.
2
How to prematurely exit a repeat loop?
Post Flair (click to view more posts with a particular flair)
Post Body

So Iโ€™m trying to make a shortcut that tries to find prime numbers (here it is, if you want to take a look) and it primarily does this by dividing a number by every number leading up to it (besides from 1 and itself, of course) and if it finds a result that does not include a decimal, it saves the number as the new highest known prime and moves on to the next number. Repeat ad nauseam. And it does do itโ€™s job, but as you could probably guess, itโ€™s kinda slow.

so I made some minor improvements. Made it skip the number if it was even or if it had an easily checkable factor, etc. but I was wondering if it was possible to, if it finds a number that the current number can be divisible by, simply log it and move on to the next number instead of continuing to check every other number. And if you have any other advice for making it faster or cleaner, Id love to hear those suggestions too.

thanks!

Author
Account Strength
100%
Account Age
6 years
Verified Email
Yes
Verified Flair
No
Total Karma
154,463
Link Karma
135,525
Comment Karma
12,774
Profile updated: 4 months ago
Posts updated: 6 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
3 years ago