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
10 changes: 5 additions & 5 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## DESCRIPTION

Nombre:
Usuario Platzi:
Nombre: Felipe Huerta Aros
Usuario Platzi: hueeerta

## Reto:

- [ ] Primer problema
- [ ] Segundo problema
- [ ] Tercer problema
- [x] Primer problema
- [x] Segundo problema
- [x] Tercer problema
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/factorial.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const factorial = (number) => {
// your code here
}
var resultado = 1;
for (let index = resultado; index <= number; index++) {
resultado = resultado * index;
}
return resultado;
};

module.exports = factorial;
module.exports = factorial;
15 changes: 12 additions & 3 deletions src/fibonacci.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
const fibonacci = (n) => {
// your code here
}
var secuenciaFibo = [1];
for (let index = 0; index < n; index++) {
if (secuenciaFibo.length < 2) {
secuenciaFibo[index] = 1;
} else if (secuenciaFibo.length >= 2) {
secuenciaFibo[index] =
secuenciaFibo[index - 1] + secuenciaFibo[index - 2];
}
}
return secuenciaFibo;
};

module.exports = fibonacci;
module.exports = fibonacci;
17 changes: 14 additions & 3 deletions src/primalidad.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
const trialDivision = (number) => {
// your code here
}
var tipoCompuesto = 0;
var tipoPrimo = 0;
for (let index = 1; index <= number; index++) {
if (Number.isInteger(number / index)) {
tipoCompuesto++;
} else {
tipoPrimo++;
}
}
tipoCompuesto -= 2;
return tipoCompuesto == 0 ? true : false;
// console.log("Compuesto: " + tipoCompuesto + " - Primo: " + tipoPrimo);
};

module.exports = trialDivision;
module.exports = trialDivision;