Double summation + other defined variable


Hi, I am currently dealing with this math problem and I don't know how to transfer this calculation (shown in picture) into R.

I wish to express this as the function of N (and plot it in the graph for j=1:9)
The alpha_i(j) stands for the no. of the integers 1:i that its first digit is j.
And I have created a function: first_digit() to return the first digit of a positive integer.

The script below is so far I've done.
My goal is to try to get the result of the first summation (which should be in terms of i and N)
Then sum up for i=1:N to get the final result

The major problem is that I do not know how to incorporate two summations together.
Could anyone give me some idea? Thanks a lot!

 	for(i in 1:N){
 		for(b in 1:i){
		k = i:N

See this post for the approach.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.