just bruteforces a number. on my chromebook it takes about 0.28 (0.27 on turbo mode) seconds to find the worst number (9999).