10-22-2018 03:02 AM
hello there,
Can anyone tell me how do i display the prime numbers in an array indicator ?
My VI just tells only if the number is prime or not
Thank you
Regards,
Akshay
10-22-2018 03:15 AM - edited 10-22-2018 03:16 AM
Hi akshay,
Can anyone tell me how do i display the prime numbers in an array indicator ?
By putting your VI into a loop (to test more than just one number) and using autoindexing…
My VI just tells only if the number is prime or not
In a very Rube-Goldberg way…
Why do you divide by 1?
Why do you divide by every number, starting from 2? (Example: you don't need to test for "4" when you already tested for "2"…)
Why do you divide just 10 times (for divisors upto 10)?
Why don't you use the iteration condition in the FOR loop once you know the number is no prime?
10-22-2018 05:26 AM
Hello,
Check this Link, u can get some idea regarding getting Prime number