I know. An algorithm this efficient would still be worth that much. :)
But more importantly, when we talk about the running time of algorithms, we talk about the time in relation to how many bits it takes to describe the number. So linear in the size of the number is exponential in the number of bits, and that is not very interesting.
No, the regular expression described here works on numbers in unary representation. Linear to the size of the unary representation is linear to the number itself.