Gọi số kẹo ăn lần lượt trong 5 ngày là $x_1;x_2;x_3;x_4;x_5$ (các số này nguyên dương)
Ta có: $x_1+x_2+x_3+x_4+x_5=31$
$x_5=3x_1$
$x_1<x_2<x_3<x_4<x_5$
\Rightarrow $2 \le x_1 \le 4$
+$x_1=2$ \Rightarrow $x_5=6$
Vậy $x_2=3;x_3=4;x_4=5$ -->ktm
+$x_1=3$ \Rightarrow $x_5=9$
$x_2+x_3+x_4=19$
Ta có: $3x_4>x_2+x_3+x_4=19$
\Rightarrow $x_4 \ge 7$
*$x_4=7$ \Rightarrow $x_2+x_3=12$
$x_2<x_3$ \Rightarrow $x_3>6$ (vô lý)
*$x_4=8$ \Rightarrow $x_2+x_3=11$
\Rightarrow $x_3 \ge 6$
@};- $x_3=6$ \Rightarrow $x_2=5$
@};- $x_3=7$ \Rightarrow $x_2=4$
+$x_1=4$\Rightarrow $x_5=12$
\Rightarrow $x_2+x_3+x_4=15$
Do $x_1<x_2<x_3<x_4<x_5$ nên $x_1+x_2+x_3+x_4+x_5$ nhỏ nhất = 4+5+6+7+12=34>31
Vậy $x_4=8$