Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. CrxC01

    Sum of all primes numbers

    After I analyzed again what you told me I understand, thank you so much for taking time to explain me !!!
  2. CrxC01

    Sum of All Primes

    function sumPrimes(num) { // Helper function to check primality function isPrime(num) { for (let i = 2; i <= Math.sqrt(num); i++) { if (num % i == 0) return false; } return true; } // Check all numbers for primality let sum = 0; for (let i = 2; i <= num...
  3. CrxC01

    Sum of all primes numbers

    THANK YOU SO MUCH!!!! I thought that i is increased with every iteration and that’s why I thought i = 3, because when x = 4, was the second iteration and that it would be i = 3. but now I still don't understand, if x = 5, the i is still 2? beacouse if i is still 2, the condition of (i === x -...
  4. CrxC01

    Sum of all primes numbers

    Thank you for your answear. but I don't understand the part where: x++; x=4; i=3; I don't know how my the code does not add 4 beause the condition of ``else if `` is applied: (i===x-1); (3 === 4 -1 ) added(which is 5 ) += 4 (is reciving 4 becouse is executing this line of code else if...
  5. CrxC01

    Sum of all primes numbers

    hello, Can someone help me please with this algorithm? my example is 10. (A prime number is a whole number greater than 1 with exactly two divisors: 1 and itself. For example, 2 is a prime number because it is only divisible by 1 and 2. In contrast, 4 is not prime since it is divisible by 1, 2...

Part and Inventory Search

Back
Top