# Project Euler #156: Counting Digits

# Project Euler #156: Counting Digits

stevenm122084 + 2 comments Does anyone else find the description highly complicated? I don't understand how the input values relate to the problem...

jbdfr_dnph + 0 comments Indeed, for more clarity, I would rewrite the line 4 into: ... solutions of the equation f(n,1)=n are n= ....

and the line 7 into: ... the sum of all the solutions n for which ...

christine_e_hill + 0 comments Look at the Project Euler problem itself. There is at least one typo as described above.

avi_ganguly94 + 0 comments bayleef needs to spend time trying to get his explainations better

karthi_14T118 + 0 comments f(n,1) could any one explain this

singh15628 + 1 comment Can anyone tell what the excatly function f(n,d) is ?

kmcshane + 0 comments Consider a list of all positive integers <= n written in base b.

f(n,d) is the total number of times the digit "d" appears in that list.

vihisharal826 + 0 comments I am not able to get problem exactely. Can any one Around Here Who tell about problem statement clear to me just explain the problem not the solution.

jbdfr_dnph + 2 comments As my code times out, I wonder how can we be sure that the sum s(d) is finite?

For example, if I test the case b=10 and d=1, I get:

f(n,1)=n for n=0

f(n,1)=n for n=1

f(n,1)=n for n=199981

f(n,1)=n for n=199982

f(n,1)=n for n=199983

f(n,1)=n for n=199984

f(n,1)=n for n=199985

f(n,1)=n for n=199986

f(n,1)=n for n=199987

f(n,1)=n for n=199988

f(n,1)=n for n=199989

f(n,1)=n for n=199990

f(n,1)=n for n=200000

f(n,1)=n for n=200001

f(n,1)=n for n=1599981

...

f(n,1)=n for n=35199990

f(n,1)=n for n=35200000

f(n,1)=n for n=35200001

....

Diego_93 + 0 comments I think that finding that bound is part of solving this problem. However, I feel it increase infinitely.

shamas + 1 comment I don't know if you found the solution or gave up on this, but graphing it really helped me conceptualise the mathematical part of the problem more easily. I used https://plot.ly/javascript/

jbdfr_dnph + 0 comments Thanks shamas. Yes I found what to set as the upper boundary, it works for all bases. The 32 test cases now complete without timing out. My problem now is that only 10 of them give the right answer, I wish I had one of the failed ones to see where is my error.

shamas + 1 comment Let s(d) be the sum of all the solutions for which f(n,d) = n.

Does this mean that s(d) is the total number of solutions, or it is the summation of the number n for which the statement is true? The example in the instructions doesn't help clarify this...

shamas + 0 comments See jbdfr_dnph's comment. It is the sum of n for which f(n,d) = n.

No more comments

Sort 7 Discussions, By:

Please Login in order to post a comment