In 1963, Peter Hagis, Jr. provided a Hardy-Ramanujan-Rademacher-type convergent series that can be used to compute an isolated value of the partition function $Q(n)$ which counts partitions of $n$ into distinct parts. Computing $Q(n)$ by this method requires arithmetic with very high-precision approximate real numbers and it is complicated. In this paper, we investigate new connections between partitions into distinct parts and overpartitions and obtain a surprising recurrence relation for the number of partitions of $n$ into distinct parts. By particularization of this relation, we derive two different linear recurrence relations for the partition function $Q(n)$. One of them involves the thrice square numbers and the other involves the generalized octagonal numbers. The recurrence relation involving the thrice square numbers provide a simple and fast computation of the value of $Q(n)$. This method uses only (large) integer arithmetic and it is simpler to program. Infinite families of linear inequalities involving partitions into distinct parts and overpartitions are introduced in this context.