- 2,163
- 191
I couldn't test it cause the class was in the early morning. But my teacher excepted it so Idk it caused no problem.But for today I have to make 2 more flowcharts...
The forum discussion centers on creating an algorithm to determine if a given number (N) is prime. The initial approach involves a lengthy series of steps that check divisibility by all integers up to N, which is inefficient for large numbers. Participants suggest optimizing the algorithm by implementing the Sieve of Eratosthenes and limiting checks to prime divisors up to the square root of N (√N). The discussion emphasizes the importance of avoiding unnecessary calculations and using proper programming syntax for division.
PREREQUISITESStudents in computer science, aspiring programmers, and anyone interested in algorithm optimization and number theory.
It's rather sad if the flowcharts you have to write are a lot less clear than the computer program would be. In this case you really want it to be clear in your program for which values of m the trial division is done. if you haveArman777 said:I couldn't test it cause the class was in the early morning. But my teacher excepted it so Idk it caused no problem.But for today I have to make 2 more flowcharts...
for m in range (2, n/2):
for (m=2; m<= n/2; m++)
I don't know ho to write a program we didnt learn about it..But I see your point in general and you are right. Maybe yeah it was the problem. So now I have to create a flowchart to calculate a gcd for two positive integers.willem2 said:If you really have to make flowcharts, i would recommend to make and test a correct program first,