Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def isSquareResidue(x, p):
- if x == 0 or pow(x, int((p - 1) / 2), p) == 1:
- return True
- return False
- def isPerfectSquare(n, p):
- r = (n % p) * (n % p) * 5
- if isSquareResidue((r - 4) % p, p) or isSquareResidue((r + 4) % p, p):
- return True
- return False
- n = int(input())
- lisOfPrimes = [x for x in range(100) if x > 1 and len([d for d in range(2, x) if x % d == 0]) == 0]
- isFib = [False for p in lisOfPrimes if isPerfectSquare(n, p) == False]
- if len(isFib) > 0:
- print('NAO')
- else:
- print('SIM')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement