Yes I see, and I really appreciate you taking time to check this kata, but I'm really strugging to believe that there are 10000000000x "9"s under N = 10000000000. Like, where are the other numbers like 0 to 8?
It's just a sampe test, maybe a mistake when copy and pasting, I don't know...
But ok, I'll take your word and work it out!
Thank you for your time!
Check the sample tests:
Test.assertEquals(number9(1), 0, 'Nein!')
Test.assertEquals(number9(9), 1, 'Nein!') // 1/9
Test.assertEquals(number9(100), 20, 'Nein!') // 20/100 = 1/5
Test.assertEquals(number9(565754),275645, 'Nein!') // 275645/565754 almost 1/2
Test.assertEquals(number9(10000000000),10000000000, 'Nein!') // 1
Do you see how the relation grows? And numbers with more than a single 9, count as the numbers of nines in them.
I think there is no way, if we are counting 9s under N, there is no way that any number N > 9 will be it's own answer.
For example, there are 20x "9"s under N = 100 and there is 40x "9"s under N = 200
So, there is no way that there are 10000000000x "9"s under N = 10000000000
Couldn't it be that for exactly that value of n the answer is n too?
Oh, I got it, there is a test sample line that is wrong. Probably the random tests are good. I'll just comment that code line.
And why do you think it's wrong? There are a lot of nines there and you have to sum them all up to n.
No problem: In this example I just returned the variable "n" that was given to solve.
Any power users available to approve this translation during @ransy's absence?
Elixir translation awaiting approval. This includes 20 random tests whereas the original JS kata only has 3 random tests.
This comment is hidden because it contains spoiler information about the solution