Build a Prime Number Sum Calculator - Build a Prime Number Sum Calculator

Tell us what’s happening:

Bloody hell. I do not understand, Is that I am so stupid, or the learning material is not good, which does not learn??? Every single task is unbelievable, I can not understand… I have no idea how to do it…How is it possible to learn this way, no knowledge, but do the task!!! It looks like I must have previous coding experience to study here…I never felt so stupid in 40 years…

Your code so far


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36

Challenge Information:

Build a Prime Number Sum Calculator - Build a Prime Number Sum Calculator
https://www.freecodecamp.org/learn/full-stack-developer/lab-prime-number-sum-calculator/build-a-prime-number-sum-calculator

this challenge is quite challenging, it requires knowing how to find prime numbers or how to research

this is a challenge in which you could implement your research skills, algorithms for prime numbers are plenty

I just solved it and to be honest, I’m not sure if I cheated a little by calling another function to help. I’m not sure if the original intention was to have the entire logic integrated in 1 function - which somehow my brain was unable to refactor. Anyway, what I came in to say is to just keep going, it’ll eventually work out.

If you are still stuck, please consider creating an array of all natural numbers, then use a for… of… loop to filter those that match the condition to find primes.

  1. You need a (helper) function to check if a number is prime. Work on that first and foremost.
  2. Once you can determine a number is prime, you will have to use that helper function on a set of numbers. You can wrap a for loop around this to go over each item in the set, but you can also use higher order functions for this part, and your results will need to be saved to an array.
  3. For the easiest part, just add all those prime numbers you’ve gotten in a new array together.

no need to return months later, please if you want to help, answer to more recent topics

1 Like