This sort of interview is insulting. There are real problems to solve in business and elegant solutions to the 'next number in sequence' isn't one of them.
I would have probably walked out or at least snarkily asked them if these types of algorithms are what's done day to day. The answer more than likely being no.