A126211 Number of 9's in decimal expansion of 9^n.
0, 1, 0, 1, 0, 2, 0, 2, 0, 1, 0, 2, 1, 1, 2, 3, 0, 3, 5, 3, 2, 5, 2, 5, 2, 4, 3, 5, 0, 3, 2, 4, 3, 3, 2, 4, 4, 5, 3, 2, 3, 6, 2, 3, 4, 5, 2, 6, 2, 3, 1, 8, 6, 6, 5, 3, 7, 7, 2, 5, 8, 8, 6, 5, 5, 8, 10, 6, 3, 9, 7, 8, 5, 7, 6, 8, 6, 10, 7, 5, 6, 10, 10, 10, 8, 9, 7, 12, 14, 12, 7, 6, 8, 5, 10, 10, 2, 14, 6, 6
Offset: 0
Programs
-
Maple
P:=proc(n) local i,k,x,y,w,cont; y:=9; k:=y; for i from 0 by 1 to n do x:=y^i; cont:=0; while x>0 do w:=x-trunc(x/10)*10; if w=k then cont:=cont+1; fi; x:=trunc(x/10); od; print(cont); od; end: P(100);