Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions JS/10.Summation_of_primes/rajkharvar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function summationOfPrimes() {
let num = 2000000;
let result = 0;

for (let i = 2; i <= num; i++) {
if (isPrime(i)) result += i;
}

alert(result);
}

function isPrime(number) {
let result = true;

for (let i = 2; i <= Math.floor(Math.sqrt(number)); i++) {
if (number % i == 0) {
result = false;
break;
}
}
return result;
}

summationOfPrimes();
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Happy Contributing! 😃
| 07 | [10001st prime](https://projecteuler.net/problem=7) | :white_check_mark: | | | :white_check_mark: | | :white_check_mark: | :white_check_mark: | | | | | |
| 08 | [Largest product in a series](https://projecteuler.net/problem=8) | | | | :white_check_mark: | | | | | | | | |
| 09 | [Special Pythagorean triplet](https://projecteuler.net/problem=9) | :white_check_mark: | | | :white_check_mark: | | | | | | | | |
| 10 | [Summation of primes](https://projecteuler.net/problem=10) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 10 | [Summation of primes](https://projecteuler.net/problem=10) | | | :white_check_mark: | :white_check_mark: | | | :white_check_mark: | | | | | |
| 11 | [Largest product in a grid](https://projecteuler.net/problem=11) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 12 | [Highly divisible triangular number](https://projecteuler.net/problem=12) | | | | :white_check_mark: | | | :white_check_mark: | | | | | |
| 13 | [Large sum](https://projecteuler.net/problem=13) | :white_check_mark: | | | :white_check_mark: | | | | | | | | |
Expand Down Expand Up @@ -90,5 +90,3 @@ Happy Contributing! 😃
- We are reluctant to change/modify the already merged P.R. to meet the current Guidelines, as that may modify the contributer's title to that file.
- We would appriciate, if all of you could do the necessary modification, hence it won't affect your contribution as per HacktoberFest.
- Keep Up the Efforts.