Problem 29

Find number of distinct terms generated by sequence of a^b.