No. 2 pencils became the standard primarily due to the electrical conductivity of its lead (graphite). Early scanning-and-scoring machines couldn’t detect marks made by harder pencils, so No. 3 and No. 4 pencils usually resulted in erroneous results and softer pencils like No. 1s smudge.
Tidbit
