Advertisement
rahulch

Untitled

Dec 6th, 2022
731
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.38 KB | None | 0 0
  1. def is_prime(n):
  2.     if n == 1:
  3.         return False
  4.     for i in range(2, n//2):
  5.         if n % i == 0:
  6.             return False
  7.     return True
  8.  
  9. def good_keys(N):
  10.     result = 0
  11.     for i in range (1, N+1):
  12.         for j in range(1, N+1):
  13.             for k in range(1, N+1):
  14.                 if is_prime(i) and is_prime(j) and is_prime(k) and (i ^ j ^ k) == 0:
  15.                     result += 1
  16.     return result
  17.  
  18. N = input()
  19. out_ = good_keys(N)
  20. print(out_)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement