• Why not just use a cartesian of possible combinations of start and end day (42 excluding same start and end day) together with the number of days and then do a simple lookup

    Far away is close at hand in the images of elsewhere.
    Anon.