%I #26 Nov 20 2021 11:33:39
%S 1,1,1,1,1,1,1,1,1,3,7,7,8,9,10,11,12,13,14,5,17,11,10,11,12,13,14,15,
%T 16,7,19,20,15,13,14,15,16,17,18,9,21,22,23,19,16,17,18,19,20,11,23,
%U 24,25,26,23,19,20,21,22,13,25,26,27,28,29,27,22,23,24,15,27
%N a(n) is the sum of the number of occurrences of each digit of n up to and including that digit.
%H David A. Corneth, <a href="/A343644/b343644.txt">Table of n, a(n) for n = 1..10000</a>
%e a(10) = 3 as the digit 1 is the second digit 1 and the digit 0 is the first digit 0 giving 2+1.
%e a(22) is 11 as the digits of 22 are 2 and 2. Before 22 the digit 2 occurred four times, in 2, 12, 20 in 21. The first 2 in 22 is the fifth in total. The second 2 in 22 is the sixth 2 in total giving 5 + 6.
%t Array[Sum[Count[Flatten@Join[IntegerDigits/@Range[#-1],a[[;;k]]],a[[k]]],{k,Length[a=IntegerDigits@#]}]&,100] (* _Giorgos Kalogeropoulos_, Apr 23 2021 *)
%o (PARI) first(n) = my(v=vector(10), res=vector(n)); for(i=1, n, c=0; d=digits(i); for(i=1, #d, v[d[i]+1]++; c+=v[d[i]+1]); res[i]=c); res
%o (Python)
%o def aupto(limit):
%o f, alst = [0 for i in range(10)], []
%o for n in range(1, limit+1):
%o s = 0
%o for d in list(map(int, str(n))): f[d] += 1; s += f[d]
%o alst.append(s)
%o return alst
%o print(aupto(71)) # _Michael S. Branicky_, Apr 23 2021
%Y Cf. A343645.
%K nonn,easy,base,look
%O 1,10
%A _David A. Corneth_, Apr 23 2021