Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def primo(n):
- # Eu assumo que todos os valores são ímpares (pela definição do for), assim não preciso testar se é múltiplo de 2.
- for i in xrange(3, n ** .5 + 1, 2): # Se n = i * j, se i > sqrt(n), então j < sqrt(n) e esse teste já foi feito.
- if n % i == 0: return False
- return True
- num = 67590067757306080
- for i in xrange(2 ** 27 + 1, 2 ** 28, 2):
- if num % (i - 1) == 0:
- if primo(i): # p = i
- if primo(num / (i - 1) + 1): # Se (p - 1)(q - 1) = num, então q = (num / (i - 1)) + 1.
- print "%d %d" % (i, num / (i - 1) + 1);
- break
Add Comment
Please, Sign In to add comment