Skip to content

Instantly share code, notes, and snippets.

@ThomRoman
Last active May 15, 2022 22:36
Show Gist options
  • Save ThomRoman/72f6cfdde6d02a50ced8f4dd9d6bfb0b to your computer and use it in GitHub Desktop.
Save ThomRoman/72f6cfdde6d02a50ced8f4dd9d6bfb0b to your computer and use it in GitHub Desktop.
import sys
import random
listacubos = []
primos = 0
repeticiones = {}
import math
def esprimo(num):
for n in range(2,int(num**0.5)+1):
if num%n==0:
return False
return True
print("calculando ...")
for i in range(0,500001):
aleatorio = random.randint(0, sys.maxsize)
print("%s %s" % (i, aleatorio))
if aleatorio in repeticiones :
repeticiones[aleatorio] += 1
else:
repeticiones[aleatorio] = 1
if aleatorio % ( aleatorio**(1/3) ) == 0 :
listacubos.append(aletorio)
print("lista de todos los que son cubos de algún numero natural")
print("\n",listacubos)
print("\nse tuvo que generar para obtener 200 números primos.")
print(primos)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment