Attaching a cost function to integers appearing in partitions of an integer n gives rise to a natural least-cost or greatest-profit problem. We present several modifications of the standard O(n2) dynamic programming algorithm for the least-cost problem. One modification results in an average complexity of order O(n3/2 by restriction of possible substitutions; a second in an efficient print algorithm for display of the resultant partition. A third, a prepass eliminating some equations from consideration, guarantees O(n) or O(n log n) efficiency in a number of important special cases; in particular, we can guarantee such efficiency whenever the unit cost function is even approximately monotonically increasing or decreasing. We also give a related algorithm for the problem of partitioning an integer by integers no larger than some upper bound p, of complexity polynomial in p. Finally, we show that no modification of the dynamic programming algorithm (using only pair comparison and information from the permutation of integers induced by sorting the unit costs) is worst-case better than ω(n2).