added naive but working algorithm for 148, but runs too slowly