Quit

Clear[a]
a[n_]:=a[n]=First[IntegerDigits[(2^n)]]

tabela=Monitor[Table[a[i],{i,0,(10^4)}],i];

Histogram[tabela,{0.5,10,1},"Probability",ImageSize->600,Ticks->{Range[9],Automatic},LabelingFunction->Above]