Let and . The dual of is . For every , , so weakly. A compact operator sends a weakly convergent sequence to a norm-convergent sequence with the corresponding limit. Indeed, any failure of would give a subsequence bounded away from zero, with a further norm-convergent subsequence by compactness; weak continuity of forces that norm limit to be zero, a contradiction. The condition is therefore necessary.
For failure of sufficiency, partition the positive integers into consecutive blocks
and define the block averaging compactness counterexample
By Hölder's inequality, . Summing over disjoint blocks shows , so is bounded. If , then ; as , also , so .
However, the vectors have norm one and satisfy . Distinct output vectors have distance , so this bounded sequence of inputs has no norm-convergent image subsequence. Thus is not compact.
To connect with the hint, define for . Then is an isometry, and the dual pairing calculation gives . The vectors have disjoint supports and norm one. The direct estimates above establish the counterexample without relying only on the hint.