Store all the powers of y < bound in a vector to avoid calculating them again and again
powersOfY . append ( 1 ) NEW_LINE i = y NEW_LINE while i < bound and y != 1 : NEW_LINE INDENT powersOfY . append ( i ) NEW_LINE i *= y NEW_LINE DEDENT i = 0 NEW_LINE while ( True ) : NEW_LINE