From e066f594fa7867c3c355f527e91d02ed475566a5 Mon Sep 17 00:00:00 2001 From: Luis Miguel Osorio Marin <68092335+MigueOsorio08@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:20:58 -0500 Subject: [PATCH 1/4] Update factorial.js --- src/factorial.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/factorial.js b/src/factorial.js index 4f3ae70..05a0232 100644 --- a/src/factorial.js +++ b/src/factorial.js @@ -1,5 +1,16 @@ const factorial = (number) => { // your code here + function factorial (num){ + if(num <= 0){ + console.log("Lo sentimos, el numero debe ser mayor que cero"); + }else{ + let factorial = num; + for(let i = (num - 1); i > 1; i--){ + factorial *= i; + } + return `El factorial de ${num} es: ${factorial}` + } +} } -module.exports = factorial; \ No newline at end of file +module.exports = factorial; From e4acc60a27022a9bce092431d5371354ec463ae3 Mon Sep 17 00:00:00 2001 From: Luis Miguel Osorio Marin <68092335+MigueOsorio08@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:21:18 -0500 Subject: [PATCH 2/4] Update fibonacci.js --- src/fibonacci.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/fibonacci.js b/src/fibonacci.js index ea3270f..a0da9cb 100644 --- a/src/fibonacci.js +++ b/src/fibonacci.js @@ -1,5 +1,22 @@ const fibonacci = (n) => { // your code here + function fibonacci(num){ + // El parametro indica la cantidad de numeros que se quieren obtener de la secuencia + let partida = 0; + let inicial = 1; + let array = []; + + if(num <= 0){ + console.log("Lo sentimos, el numero debe ser mayor que uno"); + }else{ + for(let i = 0; i < num; i++){ + array.push(partida); + partida += inicial; + inicial = array[i]; + } + } + return array; +} } -module.exports = fibonacci; \ No newline at end of file +module.exports = fibonacci; From 59a4ce0fe6fd07aa9d11126d8c49237337c74f9f Mon Sep 17 00:00:00 2001 From: Luis Miguel Osorio Marin <68092335+MigueOsorio08@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:21:40 -0500 Subject: [PATCH 3/4] Update primalidad.js --- src/primalidad.js | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/primalidad.js b/src/primalidad.js index 8bdb849..04a79b0 100644 --- a/src/primalidad.js +++ b/src/primalidad.js @@ -1,5 +1,29 @@ const trialDivision = (number) => { // your code here + function primo (num){ + let contador = 0; + let valor; + let mensaje; + if(num <= 1){ + mensaje = "Lo sentimos, el numero debe ser mayor que uno"; + }else{ + for(let i = num; i > 1; i--){ + for(let j = 1; j <= num; j++){ + valor = i * j; + if(valor == num){ + contador++; + } + } + } + if(contador <= 2){ + mensaje = `El numero ${num} es primo` + }else{ + mensaje = `El numero ${num} no es primo` + } + } + + return mensaje; +} } -module.exports = trialDivision; \ No newline at end of file +module.exports = trialDivision; From e002ad8de6648f58c40076d1c5a1762bc4ce8187 Mon Sep 17 00:00:00 2001 From: Luis Miguel Osorio Marin <68092335+MigueOsorio08@users.noreply.github.com> Date: Tue, 6 Sep 2022 16:22:43 -0500 Subject: [PATCH 4/4] Update PULL_REQUEST_TEMPLATE.md --- PULL_REQUEST_TEMPLATE.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 2449150..604d46a 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,7 @@ ## DESCRIPTION -Nombre: -Usuario Platzi: +Nombre: Luis Miguel Osorio Marin +Usuario Platzi: Miguel Osorio miguelosorio613@gmail.com ## Reto: