A modular -coloring, , of a graph without isolated vertices is a coloring of the vertices of with the elements in (where adjacent vertices may be colored the same) having the property that for every two adjacent vertices in the sums of the colors of their neighbors are different in . The minimum for which has a modular -coloring is the modular chromatic number mc of . It is known that for every nontrivial tree . We present an efficient algorithm that computes the modular chromatic number of a given tree.