| 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "math/big" |
| 6 | ) |
| 7 | |
| 8 | func main() { |
| 9 | // 157 bit n = pq with p ~= 78 bits |
| 10 | n := big.NewInt(0) |
| 11 | n.SetString("273966616513101251352941655302036077733021013991", 10) |
| 12 | |
| 13 | i := big.NewInt(0) |
| 14 | // Set i to be p - 10e6 |
| 15 | i.SetString("496968652506233112158689", 10) |
| 16 | |
| 17 | // Move temp big int out here so no possible GC thrashing |
| 18 | temp := big.NewInt(0) |
| 19 | // Avoid creating the new bigint each time |
| 20 | two := big.NewInt(2) |
| 21 | for { |
| 22 | // Check if the odd number is a divisor of n |
| 23 | temp.Mod(n, i) |
| 24 | if temp.Sign() == 0 { |
| 25 | fmt.Println(i) |
| 26 | break |
| 27 | } |
| 28 | |
| 29 | i.Add(i, two) |
| 30 | } |
| 31 | } |