Solution:
If a dwarf X performs the same type of work on three days D1,D2,D3, then we say that this triple of days is monotonous for X. We claim that the following configuration cannot occur: There are three dwarves X1,X2,X3 and three days D1,D2,D3, such that the triple (D1,D2,D3) is monotonous for each of the dwarves X1,X2,X3.
(Proof: Suppose that such a configuration occurs. Then among the remaining dwarves there exist three dwarves Y1,Y2,Y3 that performed both types of work on day D1 and on day D2; without loss of generality these three dwarves worked in the mine on day D1 and collected berries on day D2. On day D3, two of Y1,Y2,Y3 performed the same type of work, and without loss of generality Y1 and Y2 worked in the mine. But then on days D1 and D3, each of the five dwarves X1,X2,X3,Y1,Y2 performed only one type of work; this is in contradiction with the problem statement.)
Next we consider some fixed triple X1,X2,X3 of dwarves. There are eight possible working schedules for X1,X2,X3 (like mine-mine-mine, mine-mine-berries, mine-berries-mine, etc). As the above forbidden configuration does not occur, each of these eight working schedules must occur on exactly two of the sixteen days. In particular this implies that every dwarf worked exactly eight times in the mine and exactly eight times in the forest.
For 0⩽k⩽7 we denote by d(k) the number of days on which exactly k dwarves were collecting berries. Since on the first day all seven dwarves were in the mine, on each of the remaining days at least three dwarves collected berries. This yields d(0)=1 and d(1)=d(2)=0. We assume, for the sake of contradiction, that d(7)=0 and hence
d(3)+d(4)+d(5)+d(6)=15
As every dwarf collected berries exactly eight times, we get that, further,
3d(3)+4d(4)+5d(5)+6d(6)=7⋅8=56
Next, let us count the number q of quadruples (X1,X2,X3,D) for which X1,X2,X3 are three pairwise distinct dwarves that all collected berries on day D. As there are 7⋅6⋅5=210 triples of pairwise distinct dwarves, and as every working schedule for three fixed dwarves occurs on exactly two days, we get q=420. As every day on which k dwarves collect berries contributes k(k−1)(k−2) such quadruples, we also have
3⋅2⋅1⋅d(3)+4⋅3⋅2⋅d(4)+5⋅4⋅3⋅d(5)+6⋅5⋅4⋅d(6)=q=420
which simplifies to
d(3)+4d(4)+10d(5)+20d(6)=70
Finally, we count the number r of quadruples (X1,X2,X3,D) for which X1,X2,X3 are three pairwise distinct dwarves that all worked in the mine on day D. Similarly as above we see that r=420 and that
7⋅6⋅5⋅d(0)+4⋅3⋅2⋅d(3)+3⋅2⋅1⋅d(4)=r=420
which simplifies to
4d(3)+d(4)=35
Multiplying (1) by −40, multiplying (2) by 10, multiplying (3) by −1, multiplying (4) by 4, and then adding up the four resulting equations yields 5d(3)=30 and hence d(3)=6. Then (4) yields d(4)=11. As d(3)+d(4)=17, the total number of days cannot be 16. We have reached the desired contradiction.
A Variant. We follow the second solution up to equation (3). Multiplying (1) by 8, multiplying (2) by −3, and adding the two resulting equations to (3) yields
3d(5)+10d(6)=22
As d(5) and d(6) are positive integers, (5) implies 0⩽d(6)⩽2. Only the case d(6)=1 yields an integral value d(5)=4. The equations (1) and (2) then yield d(3)=10 and d(4)=0.
Now let us look at the d(3)=10 special days on which exactly three dwarves were collecting berries. One of the dwarves collected berries on at least five special days (if every dwarf collected berries on at most four special days, this would allow at most 7⋅4/3<10 special days); we call this dwarf X. On at least two out of these five special days, some dwarf Y must have collected berries together with X. Then these two days contradict the problem statement. We have reached the desired contradiction.