Dmitry Nadezhin wrote: >Nevertheless, I send this variant now in hope that it may be useful. Great! It's much faster than what I proposed, cleaner (only integers), and according to my tests it behaves the same. -Jeff