4. There are 8 consecutive positive

integers, the sum of which can be expressed as the sum of 7
consecutive positive integers, but cannot be expressed as the sum of 3 consecutive positive integers. Then, the minimum value of the largest number among these 8 consecutive positive integers is $\qquad$
4.21.

Let these 8 consecutive positive integers be
$$
a, a+1, a+2, a+3, a+4, a+5, a+6, a+7 \text {. }
$$

Their sum is $S=8a+28$, which means $S$ leaves a remainder of 4 when divided by 8.
Since $S$ is divisible by 7, we have $8a+28=7n$.
Therefore, $41n$.
Let $n=4k$, then $2a+7=7k$.
Thus, $a=\frac{7(k-1)}{2}$.
For $a$ to be a positive integer, $k$ must be a positive odd number.
When $k=1$, $a=0$, which is not a positive integer, and does not meet the requirement;
When $k=3$, $a=7, S=84$ is divisible by 3, which does not meet the requirement;

When $k=5$, $a=14, S=140$ is not divisible by 3, which meets the requirement;

When $k=7,9, \cdots$ and other odd numbers, the value of $a$ becomes greater than 14, which does not meet the requirement for the minimum value.
Therefore, when $a=14$, $a+7=21$.
Thus, the smallest maximum value of these 8 consecutive positive integers is 21.