Week 24 - Prime numbers

posted Jun 2, 2017, 1:14 PM by Attila Lengyel
def prime(number):
  if number > 1:
    for x in range(2,number):
      if (number % x) == 0:
        return False
    else:
      return True

sum = 0
for x in range(1, 10000):
  if prime(x):
    sum += x
print (sum)

for x in range(700,799):
  if prime(x):
    sX = str(x)
    prod = int(sX[0]) * int(sX[1]) * int(sX[2])
    print(sX, prod)


Comments