02-25-2013 11:50 AM
hello, i'm doing a homework, can you help me?
i need Develop a program in half-second intervals prime numbers from 1 to 100
someone can help me!!
please!
thanks!
02-25-2013 11:57 AM
Please use a better subject. All posts here are about LabVIEW.
Please be specific about the sort of help you need. This is not a homework service but if you are stuck with something, people will assist you. You need to show the code that you have already written and explain your specific problem.
02-25-2013 12:07 PM
If i am asking is because i dont understand that problem....really i´m just studying labview...sorry.-!
02-25-2013 12:20 PM
You need to create a program that shows a new prime number every 500ms?
First I would say make a VI that can figure out if a number is prime.
Use a FOR loop with number of iterations set to 100. The i is 0 based, so you will want to use the increment function to get the number to work with. If the number is prime, display it and wait 500ms. If the number is not prime, don't display or wait.
02-25-2013 12:39 PM
i'm doing whith 2n+1 and i'm doing whith a while. because i need numbers prime since 1 to 100...-!
Thanks!
02-25-2013 01:10 PM - edited 02-25-2013 01:11 PM
While many of the numbers your method will create will be prime numbers, many will not be prime, for example 15 occurs pretty early, but isn't a prime (it is made up of two primes 3 and 5), and you miss the first prime, 2.
02-25-2013 01:10 PM
A for loop would probably be a better option than the while loop. You were given the basics of what you need to do in an earlier post. As mentioned, this forum is not here to do the work for you. You will learn far more doing it yourself. We will be happy to answer specific questions about issues you are encountering. You really do need to post what code you have done so far.
02-25-2013 01:17 PM
Are you looking for 100 prime numbers, or looking for the numbers between 1 and 100 that are prime?
Have you researched any algorithms or schemes to determine if a number is prime?
If you have a number, and go through every number less than that to determine if the number is divisible by that, you can throw the number out as non-prime has soon as you find a number divisible into it. I think a function such as quotient/remainder would help you here.