Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //autor:Andy dela Cruz
- var num=1;
- var numero=1;
- var numerosPrimos=[];
- var suseción=function(numero){
- if(numero>10000){
- var maximo=numerosPrimos[numerosPrimos.length-1];
- console.log ("El mayor factor primo del número 600851475143 es " + maximo + ".");
- }else{
- if(600851475143%numero===0){
- divisible=(numero/2);
- if(divisible%2===0 || divisible%3===0 ){
- console.log("no es numero primo");
- }else{
- console.log ('numero primo es: ' + numero);
- numerosPrimos.push(numero);
- num*=numero;
- }
- }
- numero++
- suseción(numero)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement