Advertisement
guvejokua

chenAsali

Nov 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. def asal(x):
  2. for i in range(2, x-1, 1):
  3. kalan = x % i
  4. if kalan == 0:
  5. return 0
  6. return 1
  7.  
  8. def chenIkıAsalinCarpimi(y):
  9. for k in range(2, y-4, 1):
  10. if y % k == 0:
  11. if asal(int(y/k)):
  12. if asal(k):
  13. print("Asal çarpanlar = {}, {} ".format(k, y/k))
  14. return 1
  15. return 0
  16.  
  17. toplam = 0
  18.  
  19. for j in range(2, 100000, 1):
  20. if asal(j):
  21. if asal(j+2):
  22. toplam = toplam + 1
  23. print("Direk : {}\n".format(j))
  24. elif chenIkıAsalinCarpimi(j+2):
  25. toplam = toplam + 1
  26. print("Bölümünden : {}\n".format(j))
  27.  
  28. print(toplam)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement