Writing recursive rules for arithmetic and geometric sequences