3744 - ELHC: Difference between revisions

From Bitnami MediaWiki
Raul (talk | contribs)
No edit summary
Raul (talk | contribs)
No edit summary
 
Line 10: Line 10:
     else:
     else:
         return 0
         return 0


if __name__ == '__main__':
if __name__ == '__main__':

Latest revision as of 15:11, 4 December 2023

def prim(int n):

   cnt = 0
   for i in range(1, int(n) + 1):
       if n % i == 0:
           cnt += 2
       if i * i == n:
           cnt -= 1
   if cnt == 2:
       return 1
   else:
       return 0

if __name__ == '__main__':

  n = int(input())
  for i in range(2, n + 1):
      if prim(i):
  print(i, end=' ')