fix(guide): restructure curriculum guide articles (#36501)

* fix: restructure certifications guide articles
* fix: added 3 dashes line before prob expl
* fix: added 3 dashes line before hints
* fix: added 3 dashes line before solutions
This commit is contained in:
Randell Dawson
2019-07-24 00:59:27 -07:00
committed by mrugesh
parent c911e77eed
commit 1494a50123
990 changed files with 13202 additions and 8628 deletions

View File

@@ -1,29 +1,35 @@
---
title: Largest prime factor
---
## Problem 3: Largest prime factor
# Problem 3: Largest prime factor
### Method:
---
## Problem Explanation
- To find the largest prime factor of a number, we start from the smallest prime factor 2 and divide the number with it.
- If the remainder is 0 that means the number is divisible by that prime number, we keep dividing the number by same prime number until that number is no more divisible by that prime number.
- After that, we incrememnt the prime factor by 1 and repeat this process till the number becomes 1.
### Solution:
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
```js
function largestPrimeFactor(number) {
let prime = 2, max = 1;
while (prime <= number){
let prime = 2,
max = 1;
while (prime <= number) {
if (number % prime == 0) {
max = prime;
number = number/prime;
}
else prime++; //Only increment the prime number if the number isn't divisible by it
number = number / prime;
} else prime++; //Only increment the prime number if the number isn't divisible by it
}
return max;
}
```
### Resources:
#### Relevant Links
- [Wikipedia](https://en.wikipedia.org/wiki/Prime_number)
</details>