<p>Given a date how can I add a number of days to it, but exclude weekends. For example, given 11/12/2008 (Wednesday) and adding five will result in 11/19/2008 (Wednesday) rather than 11/17/2008 (Monday).</p>

<p>I can think of a simple solution like looping through each day to add and checking to see if it is a weekend, but I'd like to see if there is something more elegant. I'd also be interested in any F# solution.</p>

Given the number of the original day in the year D and original day in the week W and the number of workdays to add N, the next weekday number is
```
```
W + N % 5.
```
```
The next day in the year (with no wraparound check) is
```
```
D + ((N / 5) * 7) + N % 5).
```
```
This is assuming that you have integer division.