jump to navigation

Problem of the Day #93: Two Functions June 20, 2011

Posted by Seungln in : potd , trackback

Let $f(x)$ be the sum of the digits of $x$. For example,

$$f(123) = 1+2+3 = 6$$

and

$$f(1337) = 1 + 3 + 3 + 7 = 14$$

Let $g(x)$ be the difference between the sum of every other digit from the units digit and the sum of every other digit from the tens digit of $x$. For example, $$g(1337) = (3 + 7) – (1 + 3) = 10 – 4 = 6$$ and $$g(7654321) = (1 + 3  + 5 + 7) – (2 + 4 + 6) = 16 – 12 = 4$$ Compute the number of integers $x$ in the range $[1,100000]$ such that $f(x) = g(x)$.

Comments»

no comments yet - be the first?