Mike mailed me his two solutions, here they are: def symbolify(i) i<1?"?*-?*":"(?*-?))"+"--(?*-?))"*(i-1) end def simbolify(i) "(?*-?*)"+"--(?*-?))"*i end