You must aim either for x/x/x/31/31/31 or for x/x/x/31/31/30. Here the method to breed for x/x/x/31/31/31 is described, since maximum speed is more important and it has a higher chance to get Hidden Power ICE.
1. x/x/x/x/x/31 + x/x/x/x/x/x = x/x/x/x/x/31 (1:4)
2. x/x/x/x/31/x + x/x/x/x/x/31 = x/x/x/x/31/31 (1:17)
3. a) x/x/x/x/31/31 + x/x/x/31/x/x = x/x/x/31/31/x (1:17)
or b) x/x/x/x/31/31 + x/x/x/31/x/x = x/x/x/31/x/31 (1:17)
4. a) x/x/x/31/31/x + x/x/x/x/31/31 = x/x/x/31/31/31 (1:54)
or b) x/x/x/31/x/31 + x/x/x/x/31/31 = x/x/x/31/31/31 (1:54)
5. a) x/x/x/31/31/31 + x/x/x/31/31/x = x/x/x/31/31/31 (1:29)
or b) x/x/x/31/31/31 + x/x/x/31/x/31 = x/x/x/31/31/31 (1:29)
or c) x/x/x/31/31/31 + x/x/x/x/31/31 = x/x/x/31/31/31 (1:29)
6. x/x/x/31/31/31 + x/x/x/31/31/31 = x/x/x/31/31/31 (1:16)
About every 16th baby will now have a chance to have Hidden Power ICE with base power at least 65, if any one of the following holds:
* HP IV is an odd number, Defense IV and Attack IV are even numbers
* Attack IV is an odd number, HP IV and Defense IV are even numbers
* HP IV, Attack IV and Defense IV are all even numbers
This means that the highest IVs you can have for Hidden Power ICE with a 31 Speed IV are either 31/30/30/31/31/31 or 30/31/30/31/31/31.