Skip to content
Snippets Groups Projects
Commit 7184dcc1 authored by Juan Esteban Gomez Garcia's avatar Juan Esteban Gomez Garcia
Browse files

Upload New File

parent e7faf68e
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:5ad2f3ef-3ff4-40b4-a46c-5e7fc31251fc tags:
# Números Primos
%% Cell type:code id:0462aaea-16a8-4649-ab6a-4972f3563742 tags:
``` python
import numpy as np
```
%% Cell type:code id:d8dfe559-d961-4813-8098-021f28c9683c tags:
``` python
numeros = np.arange(2,101,1)
primos = []
def primo(numero):
for i in range(2,numero):
if (numero%i) == 0:
return 'No Primo'
return 'Primo'
for i in range(len(numeros)):
if primo(numeros[i]) == 'Primo':
primos.append(numeros[i])
print(primos)
suma = 0
for j in range(len(primos)):
suma += primos[j]
print(suma)
```
%% Output
[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
1060
%% Cell type:code id:fc4c472b-a1c6-4073-b808-a49798d3eef7 tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment