Skip to content

Commit d4bf02f

Browse files
authored
Merge pull request vJechsmayr#138 from paulatulis/paula_t_algo
two sum alternate solution and prime check
2 parents d65a9b8 + 553af77 commit d4bf02f

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

‎Maths/Algorithms_toDo.md‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
+ gaussian
44
+ is square free
5-
+ prime check
65
+ prime factors

‎Maths/primeCheck.js‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function primeCheck(n){
2+
if (n === 1){
3+
return false;
4+
}
5+
else if (n === 2){
6+
return true;
7+
}
8+
9+
for(let i = 2; i < n; i++){
10+
if(n % i === 0){
11+
return false;
12+
}
13+
}
14+
15+
return true;
16+
}

0 commit comments

Comments
 (0)