PUZZLE IBM-079
Sum of numbers after worm ate some
IBM Research · Ponder This · 2004-11
IBM Ponder This #079 · November 2004
Puzzle for November 2004
This month's puzzle again comes from IQSTAR.
One or both parts can be solved.
Part 1:
The numbers 1 to 9999 (decimal base) were written on a paper. Then the paper was partially eaten by worms. It happened that just those parts of paper with digit "0" were eaten. Consequently the numbers 1200 and 3450 appear as 12 and 345 respectively, whilst the number 6078 appears as two separate numbers 6 and 78. What is the sum of the numbers appearing on the worm-eaten paper?
Part 2:
Suppose the numbers are represented in the base b system. The digits are 0,1,2,3,...,a, where numerically "a" is equal to b-1. The first b^n-1 numbers, 1 through aaa...a, (that is, the last number is an n-digit number with all its digits
equal to "a") were written on a paper. Then it happened that just those parts of paper with the digits "0", "1", ..., "x-1" were worm-eaten (i.e. the remaining numbers consist of digits belong to {"x", "x+1", ..., "a"}, and suppose 0<x<a). For example, in Part 1 we have b=10, a=9, n=4 and x=1. What is the sum of the numbers appearing on the worm-eaten paper in terms of b, n and x?
Solution
Best opened after a real attemptTo be added.