FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScriptAlgorithm/Project-Euler/Problem010.js at master · me-hasan/JavaScriptAlgorithm · GitHub
me-hasan
/
JavaScriptAlgorithm
Public
forked from
RabibHossain/JavaScriptAlgorithm
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScriptAlgorithm
/
Project-Euler
/
Problem010.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
24 lines (21 loc) · 489 Bytes
Breadcrumbs
JavaScriptAlgorithm
/
Project-Euler
/
Problem010.js
Copy path
File metadata and controls
24 lines (21 loc) · 489 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// https://projecteuler.net/problem=10
const
isPrime
=
(
number
)
=>
{
if
(
number
===
2
)
return
true
if
(
number
%
2
===
0
)
return
false
for
(
let
j
=
3
;
j
*
j
<=
number
;
j
+=
2
)
{
if
(
number
%
j
===
0
)
{
return
false
}
}
return
true
}
const
calculateSumOfPrimeNumbers
=
(
maxNumber
)
=>
{
let
sum
=
0
for
(
let
i
=
maxNumber
-
1
;
i
>=
2
;
i
--
)
{
if
(
isPrime
(
parseInt
(
i
)
)
===
true
)
{
sum
+=
i
}
}
return
sum
}
export
{
calculateSumOfPrimeNumbers
}
Back
|
FazBrowse Home
|
New Git URL