I need an algorithm that finds how many prime numbers are in a set interval; the interval maximum range is 1 000 000 so a brute force method of checking every number is kinda inefficient
mikeshadow
0
Newbie Poster
Recommended Answers
Jump to PostHave you done a search for the phrase prime number on this site?
You can find a multitude of examples in multiple languages.
Jump to PostSo what you need is more like prime factorization. There are many threads on this site that talk about that.
Jump to Postwho told you that 121 is a prime number oh please
If it did anything useful, your program would...
besides the code i have written works perfectly fine and i have tested it a hundred times
Really? I entered 130 and it output 32. How is that useful?
I added …
Jump to PostAnd what the heck is 50????
The number of rohan-primes between 0 and 200. :icon_mrgreen:
All 14 Replies
thines01
401
Postaholic
Team Colleague
Featured Poster
mikeshadow
0
Newbie Poster
frogboy77
73
Posting Pro in Training
rohan121212
-4
Light Poster
frogboy77
commented:
terrible advice and worse code
-1
LRRR
9
Junior Poster in Training
zeroliken
commented:
+rep, For clarifying the code above
+6
rohan121212
-4
Light Poster
zeroliken
79
Nearly a Posting Virtuoso
mikeshadow
0
Newbie Poster
NathanOliver
429
Veteran Poster
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Caligulaminus
35
Junior Poster
WaltP
commented:
Ahh of course. how stupid of me! ;o)
+17
Lerner
582
Nearly a Posting Maven
jaskij
45
Junior Poster in Training
mikeshadow
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.