OFFSET
0,10
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
EXAMPLE
For n=19 we have 12 because the digit (19 mod 9)=1 is present 12 times: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19.
For n=20 we have 3 because the digit (20 mod 9)=2 is present 3 times: 2, 12, 20.
MAPLE
P:=proc(n, m) local a, b, c, d, i, v; v:=array(1..m); for i from 1 to m-1 do v[i]:=1; print(1); od; if m=10 then v[m]:=1; print(1); else v[m]:=0; print(0); fi; for i from m+1 by 1 to n do a:=(i mod m); for b from i-m+1 by 1 to i do d:=b; while d>0 do c:=d-(trunc(d/10)*10); d:=trunc(d/10); if c=a then if a=0 then v[m]:=v[m]+1; else v[a]:=v[a]+1; fi; fi; od; od; if a=0 then print(v[m]); else print(v[a]); fi; od; end: P(101, 9);
MATHEMATICA
Table[Count[Flatten[IntegerDigits/@Range[n]], Mod[n, 9]], {n, 100}] (* Harvey P. Dale, Jan 01 2022 *)
CROSSREFS
KEYWORD
easy,base,nonn
AUTHOR
Paolo P. Lava and Giorgio Balzarotti, Jan 18 2008
STATUS
approved